diff --git a/tools/profiler/TableTicker.cpp b/tools/profiler/TableTicker.cpp index 9a3577091063..4b4f4c010521 100644 --- a/tools/profiler/TableTicker.cpp +++ b/tools/profiler/TableTicker.cpp @@ -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(-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(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)")); diff --git a/tools/profiler/platform-win32.cc b/tools/profiler/platform-win32.cc index bb6293caec0b..1a8830d03f23 100644 --- a/tools/profiler/platform-win32.cc +++ b/tools/profiler/platform-win32.cc @@ -136,6 +136,7 @@ class SamplerThread : public Thread { sample->sp = reinterpret_cast
(context.Esp); sample->fp = reinterpret_cast
(context.Ebp); #endif + sample->context = &context; sampler->SampleStack(sample); sampler->Tick(sample); } diff --git a/tools/profiler/platform.h b/tools/profiler/platform.h index 920bc97b00bb..c67d3540d728 100644 --- a/tools/profiler/platform.h +++ b/tools/profiler/platform.h @@ -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.