aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 07:12:26 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 07:12:26 +0000
commitc7220c53b8136993fd1b095dc0dba73507fcd464 (patch)
tree754090db27860c905ae9aa304ee9f3351eed3f77
parentc58287cd0889888968a6bba96e9b744fbd2d4d30 (diff)
downloadruby-c7220c53b8136993fd1b095dc0dba73507fcd464.tar.gz
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
-rw-r--r--addr2line.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/addr2line.c b/addr2line.c
index e5442cca23..5b9a35a089 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;