summaryrefslogtreecommitdiff
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-18 18:05:39 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-18 18:05:39 +0000
commit8752634a971265d54dfc29b112360633c2be5a76 (patch)
tree78e0627db85cd28de01e90f64660007c4afa9b5d /addr2line.c
parent5fd6558502b30e1450023b73a7bbbd8f419767c7 (diff)
explictly skip compressed debug line
To identify the line of backtrace with ease, show the offset address of library. You can just find the source filename and the line with `addr2line -e libruby.so.2.5.0 0xXXXX` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/addr2line.c b/addr2line.c
index b59623f5b3..13bf747655 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -13,6 +13,7 @@
#include "addr2line.h"
#include <stdio.h>
+#include <stdbool.h>
#include <errno.h>
#ifdef USE_ELF
@@ -486,6 +487,7 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
ElfW(Shdr) *dynsym_shdr = NULL, *dynstr_shdr = NULL;
obj_info_t *obj = *objp;
uintptr_t dladdr_fbase = 0;
+ bool compressed_p = false;
fd = open(binary_filename, O_RDONLY);
if (fd < 0) {
@@ -555,6 +557,9 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
break;
case SHT_PROGBITS:
if (!strcmp(section_name, ".debug_line")) {
+ if (shdr[i].sh_flags & SHF_COMPRESSED) {
+ compressed_p = true;
+ }
debug_line_shdr = shdr + i;
}
else if (!strcmp(section_name, ".gnu_debuglink")) {
@@ -632,7 +637,8 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
goto finish;
}
- if (parse_debug_line(num_traces, traces,
+ if (!compressed_p &&
+ parse_debug_line(num_traces, traces,
file + debug_line_shdr->sh_offset,
debug_line_shdr->sh_size,
obj, lines, offset))
@@ -748,7 +754,7 @@ next_line:
kprintf("[0x%lx]\n", addr);
}
else if (!line->saddr || !line->sname) {
- kprintf("%s [0x%lx]\n", line->path, addr);
+ kprintf("%s(0x%lx) [0x%lx]\n", line->path, addr-line->base_addr, addr);
}
else if (line->line <= 0) {
kprintf("%s(%s+0x%lx) [0x%lx]\n", line->path, line->sname,