Skip to content

Commit

Permalink
libexecinfo: Preserve tags in backtrace_symbols_fmt().
Browse files Browse the repository at this point in the history
  • Loading branch information
dstolfa authored and bsdjhb committed Feb 29, 2024
1 parent c1a2976 commit 5c8f784
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contrib/libexecinfo/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ backtrace_symbols_fmt(void *const *trace, size_t len, const char *fmt)
}

/* Change offsets to pointers */
for (size_t j = 0; j < len; j++)
((char **)(void *)ptr)[j] += (intptr_t)ptr;
for (size_t j = 0; j < len; j++) {
ptrdiff_t ptr_offs = (intptr_t)((char **)(void *)ptr)[j];
((char **)(void *)ptr)[j] = ptr + ptr_offs;
}

out:
symtab_destroy(st);
Expand Down

0 comments on commit 5c8f784

Please sign in to comment.