]> Cypherpunks.ru repositories - gostls13.git/commit
debug/dwarf: don't try to parse addr/rnglists header
authorIan Lance Taylor <iant@golang.org>
Fri, 11 Dec 2020 23:15:43 +0000 (15:15 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 14 Dec 2020 18:06:06 +0000 (18:06 +0000)
commit828746ec57e76e49527791bca500b27b77576d79
tree4a4eca98e664d724ad006d2b6ed882881c74f36e
parentbe10af7c4e818566f0b19fb9ffefce2853722842
debug/dwarf: don't try to parse addr/rnglists header

In an executable, the debug_addr and debug_rnglists sections are
assembled by concatenating the input sections, and each input section
has a header, and each header may have different attributes. So just
parsing the single header isn't right.  Parsing the header is not
necessary to handle offsets into these sections which is all we do.

Looking at the header is also problematic because GCC with
-gsplit-dwarf when using DWARF versions 2 through 4 emits a
.debug_addr section, but it has no header.  The header was only added
for DWARF 5. So we can't parse the header at all for that case, and we
can't even detect that case in general.

This CL also fixes SeekPC with addrx and strx formats, by not using
the wrong compilation unit to find the address or string base.
To make that work when parsing the compilation unit itself, we add
support for delay the resolution of those values until we know the base.

New test binaries built with

gcc -gdwarf-5 -no-pie debug/dwarf/testdata/line[12].c
(gcc (Debian 10.2.0-15) 10.2.0)

clang -gdwarf-5 -no-pie debug/dwarf/testdata/line[12].c
(clang version 9.0.1-14)

Change-Id: I66783e0eded629bf80c467767f781164d344a54d
Reviewed-on: https://go-review.googlesource.com/c/go/+/277233
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/debug/dwarf/dwarf5ranges_test.go
src/debug/dwarf/entry.go
src/debug/dwarf/entry_test.go
src/debug/dwarf/open.go
src/debug/dwarf/testdata/line-clang-dwarf5.elf [new file with mode: 0644]
src/debug/dwarf/testdata/line-gcc-dwarf5.elf [new file with mode: 0644]