mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 809317 - Add stackwalking to SAMPLER_PRINT_LOCATION on mac. r=ehsan
--HG-- extra : rebase_source : c2cb7d1b61d18054105115034585a251bce6a58b
This commit is contained in:
parent
c3f0542212
commit
09bc4ee28d
@ -1204,6 +1204,17 @@ void print_callback(const ProfileEntry& entry, const char* tagStringData) {
|
||||
case 's':
|
||||
case 'c':
|
||||
printf_stderr(" %s\n", tagStringData);
|
||||
break;
|
||||
case 'l':
|
||||
unsigned long long pc = (unsigned long long)(uintptr_t)entry.mTagPtr;
|
||||
nsCodeAddressDetails details;
|
||||
NS_DescribeCodeAddress((void*)pc, &details);
|
||||
if (details.function) {
|
||||
printf_stderr(" %s\n", details.function);
|
||||
} else {
|
||||
printf_stderr(" %#llx\n", pc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1218,8 +1229,28 @@ void mozilla_sampler_print_location()
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadProfile threadProfile(1000, stack);
|
||||
ThreadProfile threadProfile(2000, stack);
|
||||
#if defined(XP_MACOSX) && defined(USE_NS_STACKWALK)
|
||||
// Get the frame pointer
|
||||
void **bp;
|
||||
#if defined(__i386)
|
||||
__asm__( "movl %%ebp, %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
|
||||
|
||||
TickSample sample;
|
||||
sample.fp = (unsigned char*)bp;
|
||||
sample.pc = nullptr;
|
||||
sample.sp = (unsigned char*)&stack;
|
||||
|
||||
doMergeBacktrace(threadProfile, &sample, 0);
|
||||
#else
|
||||
doSampleStackTrace(stack, threadProfile, NULL);
|
||||
#endif
|
||||
|
||||
threadProfile.flush();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user