From 27386c5a95ce764759ffbf84bc3c7f3cea63624f Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 5 Dec 2012 23:10:15 +0000 Subject: [PATCH] Backout b5c19fdea86e (bug 809317) for windows build bustage --- tools/profiler/TableTicker.cpp | 60 ++++------------------------------ 1 file changed, 7 insertions(+), 53 deletions(-) diff --git a/tools/profiler/TableTicker.cpp b/tools/profiler/TableTicker.cpp index 63cc10908b31..9a3577091063 100644 --- a/tools/profiler/TableTicker.cpp +++ b/tools/profiler/TableTicker.cpp @@ -801,8 +801,12 @@ void StackWalkCallback(void* aPC, void* aSP, void* aClosure) array->count++; } -static void doMergeBacktrace(ThreadProfile &aProfile, TickSample* aSample, void* aThread) +void TableTicker::doBacktrace(ThreadProfile &aProfile, TickSample* aSample) { +#ifndef XP_MACOSX + uintptr_t thread = GetThreadHandle(platform_data()); + MOZ_ASSERT(thread); +#endif void* pc_array[1000]; void* sp_array[1000]; PCArray array = { @@ -816,13 +820,7 @@ static void doMergeBacktrace(ThreadProfile &aProfile, TickSample* aSample, void* StackWalkCallback(aSample->pc, aSample->sp, &array); #ifdef XP_MACOSX - pthread_t pt; - if (aThread) { - pt = (pthread_t)aThread; - } else { - pt = pthread_self(); - } - + pthread_t pt = GetProfiledThread(platform_data()); void *stackEnd = reinterpret_cast(-1); if (pt) stackEnd = static_cast(pthread_get_stackaddr_np(pt)); @@ -830,9 +828,6 @@ static void doMergeBacktrace(ThreadProfile &aProfile, TickSample* aSample, void* if (aSample->fp >= aSample->sp && aSample->fp <= stackEnd) rv = FramePointerStackWalk(StackWalkCallback, 0, &array, reinterpret_cast(aSample->fp), stackEnd); #else - uintptr_t thread = (uintptr_t)aThread; - GetThreadHandle(platform_data()); - MOZ_ASSERT(thread); nsresult rv = NS_StackWalk(StackWalkCallback, 0, &array, thread); #endif if (NS_SUCCEEDED(rv)) { @@ -874,16 +869,6 @@ static void doMergeBacktrace(ThreadProfile &aProfile, TickSample* aSample, void* } } } - -void TableTicker::doBacktrace(ThreadProfile &aProfile, TickSample* aSample) -{ -#ifdef XP_MACOSX - doMergeBacktrace(aProfile, aSample, GetProfiledThread(platform_data())); -#else - doMergeBacktrace(aProfile, aSample, GetThreadHandle(platform_data())); -#endif -} - #endif #if defined(USE_LIBUNWIND) && defined(ANDROID) @@ -1280,17 +1265,6 @@ 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; } } @@ -1305,28 +1279,8 @@ void mozilla_sampler_print_location() return; } - ThreadProfile threadProfile(2000, stack); -#ifdef 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 + ThreadProfile threadProfile(1000, stack); doSampleStackTrace(stack, threadProfile, NULL); -#endif threadProfile.flush();