From: mquinson Date: Wed, 23 Jan 2008 15:58:45 +0000 (+0000) Subject: And now, fix the linux layer for backtrace extraction by not using values of backtrac... X-Git-Tag: v3.3~637 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ecd2c6ffbf406f1dc3b8fac525f5f3c009a3540c And now, fix the linux layer for backtrace extraction by not using values of backtrace (ie, e->bt & e->used) before actually calling the backtrace function git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5228 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index a74a12914b..63ca68efa4 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -20,13 +20,13 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) int i; /* to get the backtrace from the libc */ - char **backtrace_syms = backtrace_symbols(e->bt, e->used); + char **backtrace_syms; /* To build the commandline of addr2line */ char *cmd, *curr; /* to extract the addresses from the backtrace */ - char **addrs = xbt_new(char *, e->used); + char **addrs; char buff[256], *p; /* To read the output of addr2line */ @@ -39,8 +39,11 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) /* To search for the right executable path when not trivial */ struct stat stat_buf; char *binary_name = NULL; - + e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE); + backtrace_syms = backtrace_symbols(e->bt, e->used); + addrs = xbt_new(char *, e->used); + e->bt_strings = NULL; /* Some arches only have stubs of backtrace, no implementation (hppa comes to mind) */