diff options
author | Peter Zhu <[email protected]> | 2022-05-13 09:32:18 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2022-05-13 10:47:50 -0400 |
commit | 09c72f41ceeb6933e3b1da4eb581c4c22e9f1b89 (patch) | |
tree | 37522850286b1a9edc7a0bdc2754dadfee2a93bb /addr2line.c | |
parent | 55ba41440543ed10748a2ed2bdc77b6553bf0b7b (diff) |
Print function name in backtrace when available
If we don't have `saddr` but have `sname` we should output `sname`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5906
Diffstat (limited to 'addr2line.c')
-rw-r--r-- | addr2line.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addr2line.c b/addr2line.c index f660be9129..e102667602 100644 --- a/addr2line.c +++ b/addr2line.c @@ -2257,9 +2257,12 @@ print_line0(line_info_t *line, void *address) else if (!line->path) { kprintf("[0x%"PRIxPTR"]\n", addr); } - else if (!line->saddr || !line->sname) { + else if (!line->sname) { kprintf("%s(0x%"PRIxPTR") [0x%"PRIxPTR"]\n", line->path, addr-line->base_addr, addr); } + else if (!line->saddr) { + kprintf("%s(%s) [0x%"PRIxPTR"]\n", line->path, line->sname, addr); + } else if (line->line <= 0) { kprintf("%s(%s+0x%"PRIxPTR") [0x%"PRIxPTR"]\n", line->path, line->sname, d, addr); |