diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-18 04:24:48 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-18 04:24:48 +0000 |
commit | f9d655c95bf9d319e9e2e5bd1ea18a73b99ed2e8 (patch) | |
tree | c9eec55baa3a24a6f92d0ef72bd1652d33d57700 /libbacktrace | |
parent | cb817b0ac4ab3188ec09cf612d75e18f1cebe739 (diff) | |
download | gcc-f9d655c95bf9d319e9e2e5bd1ea18a73b99ed2e8.tar.gz |
* elf.c (elf_add): Don't get the wrong offsets if a debug section
is missing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203810 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace')
-rw-r--r-- | libbacktrace/ChangeLog | 5 | ||||
-rw-r--r-- | libbacktrace/elf.c | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index 9c6a8839f5e..86536a16adb 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,8 @@ +2013-10-17 Ian Lance Taylor <iant@google.com> + + * elf.c (elf_add): Don't get the wrong offsets if a debug section + is missing. + 2013-10-15 David Malcolm <dmalcolm@redhat.com> * configure.ac: Add --enable-host-shared, setting up diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index c1dbc5492e0..2161ad2a258 100644 --- a/libbacktrace/elf.c +++ b/libbacktrace/elf.c @@ -759,6 +759,8 @@ elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address, { off_t end; + if (sections[i].size == 0) + continue; if (min_offset == 0 || sections[i].offset < min_offset) min_offset = sections[i].offset; end = sections[i].offset + sections[i].size; @@ -785,8 +787,13 @@ elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address, descriptor = -1; for (i = 0; i < (int) DEBUG_MAX; ++i) - sections[i].data = ((const unsigned char *) debug_view.data - + (sections[i].offset - min_offset)); + { + if (sections[i].size == 0) + sections[i].data = NULL; + else + sections[i].data = ((const unsigned char *) debug_view.data + + (sections[i].offset - min_offset)); + } if (!backtrace_dwarf_add (state, base_address, sections[DEBUG_INFO].data, |