SVN: backtracexx/backtracexx.cpp

pluto pluto at pld-linux.org
Thu Jun 19 15:33:22 CEST 2008


Author: pluto
Date: Thu Jun 19 15:33:22 2008
New Revision: 9815

Modified:
   backtracexx/backtracexx.cpp
Log:
- temporary workaround for infinite loop in _Unwind_Backtrace.
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36568


Modified: backtracexx/backtracexx.cpp
==============================================================================
--- backtracexx/backtracexx.cpp	(original)
+++ backtracexx/backtracexx.cpp	Thu Jun 19 15:33:22 2008
@@ -87,6 +87,23 @@
 #endif
 			lookupSymbol( frame );
 			trace->push_back( frame );
+			//
+			// temporary workaround for libgcc/glibc bug:
+			// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36568
+			//
+			static __thread _Unwind_Ptr prevIp = 0;
+			static __thread unsigned recursionDepth = 0;
+			unsigned const RecursionLimit = 8;
+			if ( prevIp == ip )
+			{
+				if ( ++recursionDepth > RecursionLimit )
+					return _URC_END_OF_STACK;
+			}
+			else
+			{
+				prevIp = ip;
+				recursionDepth = 0;
+			}
 			return _URC_NO_REASON;
 		}
 	}


More information about the pld-cvs-commit mailing list