diff options
| author | Alessandro Arzilli <alessandro.arzilli@gmail.com> | 2021-11-15 10:14:04 +0100 |
|---|---|---|
| committer | Than McIntosh <thanm@google.com> | 2021-11-16 18:36:59 +0000 |
| commit | 6c36c332fefdd433cfe6e6468a2542fc310e9f8a (patch) | |
| tree | f33f2443ba7db4ecd6d3f1368ad9be2b894c62a5 /src/debug/macho | |
| parent | 40effca7a13d11f3549a24a5d4b02e87c12fc6bb (diff) | |
| download | go-6c36c332fefdd433cfe6e6468a2542fc310e9f8a.tar.xz | |
debug/pe,debug/macho: add support for DWARF5 sections
Adds the same logic used in debug/elf to load DWARF5 sections.
Fixes #49590
Change-Id: Iee05b9927a6f521842b330eab8942ade3fc2bd86
Reviewed-on: https://go-review.googlesource.com/c/go/+/363895
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/debug/macho')
| -rw-r--r-- | src/debug/macho/file.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/debug/macho/file.go b/src/debug/macho/file.go index 73cfce3c76..cdc500e476 100644 --- a/src/debug/macho/file.go +++ b/src/debug/macho/file.go @@ -650,10 +650,14 @@ func (f *File) DWARF() (*dwarf.Data, error) { return nil, err } - // Look for DWARF4 .debug_types sections. + // Look for DWARF4 .debug_types sections and DWARF5 sections. for i, s := range f.Sections { suffix := dwarfSuffix(s) - if suffix != "types" { + if suffix == "" { + continue + } + if _, ok := dat[suffix]; ok { + // Already handled. continue } @@ -662,7 +666,11 @@ func (f *File) DWARF() (*dwarf.Data, error) { return nil, err } - err = d.AddTypes(fmt.Sprintf("types-%d", i), b) + if suffix == "types" { + err = d.AddTypes(fmt.Sprintf("types-%d", i), b) + } else { + err = d.AddSection(".debug_"+suffix, b) + } if err != nil { return nil, err } |
