Commit 3038d8d9 authored by pdr@chromium.org's avatar pdr@chromium.org

Add optional parameter to WTFReportBacktrace for stackframe count

This patch gives epic yakshavers an optional parameter to control
how many stackframes to show when using WTFReportBacktrace. This
just exposes a previously static framesToShow value.

Users may find this useful in debugging deep traces.

This patch does not modify the BACKTRACE macro because macros
cannot have optional parameters.
This patch does not use templates this function is in a c block which
does not support templates ("templates must have C++ linkage").

TEST=manual

Review URL: https://chromiumcodereview.appspot.com/23494018

git-svn-id: svn://svn.chromium.org/blink/trunk@157400 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b1b1abe6
......@@ -249,11 +249,11 @@ void WTFGetBacktrace(void** stack, int* size)
#endif
}
void WTFReportBacktrace()
void WTFReportBacktrace(int framesToShow)
{
static const int framesToShow = 31;
static const int framesToSkip = 2;
void* samples[framesToShow + framesToSkip];
// Use alloca to allocate on the stack since this function is used in OOM situations.
void** samples = static_cast<void**>(alloca((framesToShow + framesToSkip) * sizeof(void *)));
int frames = framesToShow + framesToSkip;
WTFGetBacktrace(samples, &frames);
......
......@@ -116,7 +116,7 @@ WTF_EXPORT void WTFLogVerbose(const char* file, int line, const char* function,
WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
WTF_EXPORT void WTFGetBacktrace(void** stack, int* size);
WTF_EXPORT void WTFReportBacktrace();
WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31);
WTF_EXPORT void WTFPrintBacktrace(void** stack, int size);
typedef void (*WTFCrashHookFunction)();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment