Provide __RETURN_ADDRESS() (from kern_priv.h) to cop with GCC and RVCT - Bug 2970 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Tue, 15 Jun 2010 12:27:04 +0100
branchGCC_SURGE
changeset 27 6ab44b3687b2
parent 23 830434fd7147
child 29 b58b1294947a
Provide __RETURN_ADDRESS() (from kern_priv.h) to cop with GCC and RVCT - Bug 2970
memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp
--- a/memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp	Fri Jun 11 16:29:21 2010 +0100
+++ b/memspy/Driver/Kernel/Source/MemSpyDriverStreamWriter.cpp	Tue Jun 15 12:27:04 2010 +0100
@@ -21,7 +21,14 @@
 #include "MemSpyDriverUtils.h"
 #include "MemSpyDriverXferBuffer.h"
 
-
+// from kern_priv.h
+#if defined(__GCC32__)
+#define __RETURN_ADDRESS() __builtin_return_address(0)
+#elif defined (__ARMCC__)
+#define __RETURN_ADDRESS() ((TAny*)__return_address())
+#else
+#define __RETURN_ADDRESS() 0	// not supported
+#endif
 
 RMemSpyMemStreamWriter::RMemSpyMemStreamWriter()
 :   iBuffer( NULL ), iCurrent( NULL ), iMax( 0 ), iMark( NULL ), iCommitted( 0 )
@@ -69,7 +76,7 @@
         }
     else
         {
-        TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteInt32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __return_address() ) );
+        TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteInt32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __RETURN_ADDRESS() ) );
         }
     //
     return ret;
@@ -89,7 +96,7 @@
         }
     else
         {
-        TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteUint32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __return_address() ) );
+        TRACE( Kern::Printf( "RMemSpyMemStreamWriter::WriteUint32() - asked to write: 0x%08x from fn: 0x%08x BUT AM FULL", aValue, __RETURN_ADDRESS() ) );
         }
     //
     return ret;