parameterize printing of backtrace
This commit is contained in:
parent
ad27752541
commit
694a8fc722
1 changed files with 4 additions and 4 deletions
|
@ -6,12 +6,12 @@
|
||||||
#ifdef __GLIBC__
|
#ifdef __GLIBC__
|
||||||
|
|
||||||
#include "execinfo.h"
|
#include "execinfo.h"
|
||||||
inline void print_backtrace(void) {
|
inline void print_backtrace(int sz = 100) {
|
||||||
int j, nptrs;
|
int j, nptrs;
|
||||||
void *buffer[100];
|
void *buffer[sz];
|
||||||
nptrs = backtrace(buffer, 100);
|
nptrs = backtrace(buffer, sz);
|
||||||
fprintf(stderr, "backtrace() returned %d addresses\n", nptrs);
|
fprintf(stderr, "backtrace() returned %d addresses\n", nptrs);
|
||||||
backtrace_symbols_fd(buffer, 100, 2);
|
backtrace_symbols_fd(buffer, sz, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(USE_WIN32)
|
#elif defined(USE_WIN32)
|
||||||
|
|
Loading…
Reference in a new issue