Bug 816117 - Part 2: Pass the thread context to NS_StackWalk on Win32. r=bgirard

This commit is contained in:
Bas Schouten 2012-12-08 06:15:21 +01:00
Родитель 5c2da9fbfd
Коммит a60a6c0bfe
3 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -819,6 +819,11 @@ void TableTicker::doBacktrace(ThreadProfile &aProfile, TickSample* aSample)
// Start with the current function.
StackWalkCallback(aSample->pc, aSample->sp, &array);
void *platformData = nullptr;
#ifdef XP_WIN
platformData = aSample->context;
#endif
#ifdef XP_MACOSX
pthread_t pt = GetProfiledThread(platform_data());
void *stackEnd = reinterpret_cast<void*>(-1);
@ -828,7 +833,7 @@ void TableTicker::doBacktrace(ThreadProfile &aProfile, TickSample* aSample)
if (aSample->fp >= aSample->sp && aSample->fp <= stackEnd)
rv = FramePointerStackWalk(StackWalkCallback, 0, &array, reinterpret_cast<void**>(aSample->fp), stackEnd);
#else
nsresult rv = NS_StackWalk(StackWalkCallback, 0, &array, thread);
nsresult rv = NS_StackWalk(StackWalkCallback, 0, &array, thread, platformData);
#endif
if (NS_SUCCEEDED(rv)) {
aProfile.addTag(ProfileEntry('s', "(root)"));

Просмотреть файл

@ -136,6 +136,7 @@ class SamplerThread : public Thread {
sample->sp = reinterpret_cast<Address>(context.Esp);
sample->fp = reinterpret_cast<Address>(context.Ebp);
#endif
sample->context = &context;
sampler->SampleStack(sample);
sampler->Tick(sample);
}

Просмотреть файл

@ -211,7 +211,8 @@ class TickSample {
Address lr; // ARM link register
#endif
Address function; // The last called JS function.
void* context; // The context from the signal handler, if available
void* context; // The context from the signal handler, if available. On
// Win32 this may contain the windows thread context.
static const int kMaxFramesCount = 64;
Address stack[kMaxFramesCount]; // Call stack.
int frames_count; // Number of captured frames.