aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-04-20 15:41:24 -0400
committerRuss Cox <rsc@golang.org>2021-04-23 21:42:56 +0000
commit073f9139497401e019e4357d110c2801c5be31e1 (patch)
treeb7c6fbc7f727c545d15d24f4530c6bf5b23011e8 /src/debug
parentcef3a442eaa1f86b81bb67fb881c5bb9e446fb13 (diff)
downloadgo-073f9139497401e019e4357d110c2801c5be31e1.tar.xz
debug/dwarf: skip over zero-length compilation units
DWARF sections generated by mingw-clang seem to include these (not often - only one out of many in the binary that I am looking at). Skipping over them, everything parses correctly. This makes TestDefaultLinkerDWARF pass on windows/arm64. Change-Id: Ie4a7daa1423f51cbc8c4aac88b1d27c3b52ee880 Reviewed-on: https://go-review.googlesource.com/c/go/+/312031 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/dwarf/unit.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/debug/dwarf/unit.go b/src/debug/dwarf/unit.go
index 29a744fd18..9b3d6e902d 100644
--- a/src/debug/dwarf/unit.go
+++ b/src/debug/dwarf/unit.go
@@ -48,7 +48,9 @@ func (d *Data) parseUnits() ([]unit, error) {
break
}
b.skip(int(len))
- nunit++
+ if len > 0 {
+ nunit++
+ }
}
if b.err != nil {
return nil, b.err
@@ -61,7 +63,9 @@ func (d *Data) parseUnits() ([]unit, error) {
u := &units[i]
u.base = b.off
var n Offset
- n, u.is64 = b.unitLength()
+ for n == 0 {
+ n, u.is64 = b.unitLength()
+ }
dataOff := b.off
vers := b.uint16()
if vers < 2 || vers > 5 {