git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8845
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
/* ignore first one, which is this xbt_backtrace_current() */
e->used--;
memmove(backtrace_syms, backtrace_syms + 1, sizeof(char *) * e->used);
/* ignore first one, which is this xbt_backtrace_current() */
e->used--;
memmove(backtrace_syms, backtrace_syms + 1, sizeof(char *) * e->used);
- addrs = xbt_new(char *, e->used);
/* Found. */
DEBUG1("Looked in the PATH for the binary. Found %s",
binary_name);
/* Found. */
DEBUG1("Looked in the PATH for the binary. Found %s",
binary_name);
if (stat(binary_name, &stat_buf)) {
/* not found */
e->used = 1;
if (stat(binary_name, &stat_buf)) {
/* not found */
e->used = 1;
e->bt_strings[0] =
bprintf("(binary '%s' not found the path)", xbt_binary_name);
e->bt_strings[0] =
bprintf("(binary '%s' not found the path)", xbt_binary_name);
curr += sprintf(curr, "%s -f -e %s ", ADDR2LINE, binary_name);
free(binary_name);
curr += sprintf(curr, "%s -f -e %s ", ADDR2LINE, binary_name);
free(binary_name);
+ addrs = xbt_new(char *, e->used);
for (i = 0; i < e->used; i++) {
/* retrieve this address */
DEBUG2("Retrieving address number %d from '%s'", i, backtrace_syms[i]);
for (i = 0; i < e->used; i++) {
/* retrieve this address */
DEBUG2("Retrieving address number %d from '%s'", i, backtrace_syms[i]);
}
fclose(maps);
free(maps_name);
}
fclose(maps);
free(maps_name);
We now need to substract this from the address we got from backtrace.
*/
We now need to substract this from the address we got from backtrace.
*/
addrs[i] = bprintf("0x%0*lx", addr_len - 2, addr - offset);
DEBUG2("offset=%#lx new addr=%s", offset, addrs[i]);
addrs[i] = bprintf("0x%0*lx", addr_len - 2, addr - offset);
DEBUG2("offset=%#lx new addr=%s", offset, addrs[i]);
for (j = i + 1; j < e->used; j++)
free(addrs[j]);
for (j = i + 1; j < e->used; j++)
free(addrs[j]);
if (!strncmp
("xbt_thread_context_wrapper", line_func,
strlen("xbt_thread_context_wrapper"))) {
if (!strncmp
("xbt_thread_context_wrapper", line_func,
strlen("xbt_thread_context_wrapper"))) {
+ free(e->bt_strings[i]);
e->bt_strings[i] = bprintf("** (in a separate thread)");
}
}
e->bt_strings[i] = bprintf("** (in a separate thread)");
}
}