Workaround brokenness of __builtin_frame_address(0) on gcc 4.1 (as shipped with FC5, at least). b=331436 r=brendan

git-svn-id: svn://10.0.0.236/trunk@192881 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2006-03-23 23:21:27 +00:00
parent bcc98b1b00
commit ee0c4c2b8e
5 changed files with 74 additions and 26 deletions

View File

@@ -91,7 +91,17 @@ void DumpStackToFile(FILE* aStream)
// Stack walking code courtesy Kipp's "leaky".
// Get the frame pointer
void **bp = (void**) __builtin_frame_address(0);
void **bp;
#if defined(__i386)
__asm__( "movl %%ebp, %0" : "=g"(bp));
#elif defined(__x86_64__)
__asm__( "movq %%rbp, %0" : "=g"(bp));
#else
// It would be nice if this worked uniformly, but at least on i386 and
// x86_64, it stopped working with gcc 4.1, because it points to the
// end of the saved registers instead of the start.
bp = (void**) __builtin_frame_address(0);
#endif
int skip = 2;
for ( ; (void**)*bp > bp; bp = (void**)*bp) {