backtracexx/backtracexx.cpp

pluto cvs at pld-linux.org
Thu Aug 24 22:53:14 CEST 2006


Author: pluto
Date: Thu Aug 24 22:53:12 2006
New Revision: 7685

Modified:
   backtracexx/backtracexx.cpp
Log:
- adjust trace for sparc and ppc (alpha and x86 nfy).


Modified: backtracexx/backtracexx.cpp
==============================================================================
--- backtracexx/backtracexx.cpp	(original)
+++ backtracexx/backtracexx.cpp	Thu Aug 24 22:53:12 2006
@@ -10,9 +10,20 @@
 {
 	namespace
 	{
-		unsigned char const* callpoint( unsigned char const* ip )
+		// extract caller's address from callee's return point.
+		unsigned char const* caller( unsigned char const* ip )
 		{
-			// not implemented yet.
+#if defined( __powerpc__ ) && !defined( __powerpc64__ )
+			// powerpc64 not tested.
+			ip -= 4;
+#elif defined( __sparc__ )
+			// the same for sparc v7/8/9.
+			ip -= 8;
+#elif defined( __alpha__ )
+			// alpha not tested yet.
+#elif defined( __i386__ ) || defined( __x86_64__ )
+			// TODO: analysis of complex addressing forms (see intel/24319102.pdf).
+#endif
 			return ip;
 		}
 
@@ -20,7 +31,7 @@
 		{
 			_Unwind_Ptr ip = _Unwind_GetIP( ctx );
 			reinterpret_cast< raw_backtrace_type* >( arg )->push_back(
-				callpoint( reinterpret_cast< unsigned char const* >( ip ) ) );
+				caller( reinterpret_cast< unsigned char const* >( ip ) ) );
 			return _URC_NO_REASON;
 		}
 	}


More information about the pld-cvs-commit mailing list