summaryrefslogtreecommitdiff
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 07:12:26 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 07:12:26 (GMT)
commit417fc484c38b0b54890625278a6c30a0e2f7503d (patch)
tree754090db27860c905ae9aa304ee9f3351eed3f77 /addr2line.c
parent33b5c610a6f94853be2557594feb861b90508f56 (diff)
check dwarf version and skip non Dwarf v4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/addr2line.c b/addr2line.c
index e5442cc..5b9a35a 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -926,7 +926,7 @@ di_read_debug_line_cu(DebugInfoReader *reader)
}
-static void
+static int
di_read_cu(DebugInfoReader *reader)
{
DW_CompilationUnitHeader32 *hdr32 = (DW_CompilationUnitHeader32 *)reader->p;
@@ -937,16 +937,19 @@ di_read_cu(DebugInfoReader *reader)
reader->q0 = reader->obj->debug_abbrev.ptr + hdr->debug_abbrev_offset;
reader->address_size = hdr->address_size;
reader->format = 64;
+ if (hdr->version != 4) return -1;
} else {
DW_CompilationUnitHeader32 *hdr = hdr32;
reader->p += 11;
reader->q0 = reader->obj->debug_abbrev.ptr + hdr->debug_abbrev_offset;
reader->address_size = hdr->address_size;
reader->format = 32;
+ if (hdr->version != 4) return -1;
}
reader->level = 0;
di_read_debug_abbrev_cu(reader);
di_read_debug_line_cu(reader);
+ return 0;
}
static void
@@ -1690,12 +1693,13 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
i = 0;
while (reader.p < reader.pend) {
//fprintf(stderr, "%d:%tx: CU[%d]\n", __LINE__, reader.p - reader.obj->debug_info, i++);
- di_read_cu(&reader);
+ if (di_read_cu(&reader)) goto use_symtab;
debug_info_read(&reader, num_traces, traces, lines, offset);
}
}
else {
/* This file doesn't have dwarf, use symtab or dynsym */
+ use_symtab:
if (!symtab_shdr) {
/* This file doesn't have symtab, use dynsym instead */
symtab_shdr = dynsym_shdr;