glog/src/stacktrace.h
f9b58c5198 Re-organize the way to produce stacktrace.
Since we introduced the API to set signal handler and print a
stacktrace, we should avoid glibc's backtrace, which may call malloc.
Basically, we choose the way to produce a stacktrace as same as
perftools.

Also, I removed GetStackFrames, which is not used and not implemented
with glibc.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@16 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-17 07:58:10 +00:00

35 lines
825 B
C

// Copyright 2000 - 2007 Google Inc.
// All rights reserved.
//
// Routines to extract the current stack trace. These functions are
// thread-safe.
#ifndef BASE_STACKTRACE_H_
#define BASE_STACKTRACE_H_
#include "config.h"
_START_GOOGLE_NAMESPACE_
// This is similar to the GetStackFrames routine, except that it returns
// the stack trace only, and not the stack frame sizes as well.
// Example:
// main() { foo(); }
// foo() { bar(); }
// bar() {
// void* result[10];
// int depth = GetStackFrames(result, 10, 1);
// }
//
// This produces:
// result[0] foo
// result[1] main
// .... ...
//
// "result" must not be NULL.
extern int GetStackTrace(void** result, int max_depth, int skip_count);
_END_GOOGLE_NAMESPACE_
#endif // BASE_STACKTRACE_H_