Branch: Tag:

2008-08-05

2008-08-05 13:34:32 by Martin Stjernholm <mast@lysator.liu.se>

Added a debug convenience macro to dump the C stack.

Rev: src/dmalloc.h:1.66

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: dmalloc.h,v 1.65 2008/06/28 18:35:58 mast Exp $ + || $Id: dmalloc.h,v 1.66 2008/08/05 13:34:32 mast Exp $   */      #ifndef DMALLOC_H
20:   #include <execinfo.h>   typedef void *c_stack_frame;   #define C_STACK_TRACE +  + #define DUMP_C_STACK_TRACE() do { \ +  c_stack_frame bt[100]; \ +  int n = backtrace (bt, 100); \ +  backtrace_symbols_fd (bt, n, 2); \ +  } while (0) +  + #else + #define DUMP_C_STACK_TRACE() do {} while (0)   #endif      #define DMALLOC_NAMED_LOCATION(NAME) \