mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
[release-branch.go1.16] debug/pe,debug/macho: add support for DWARF5 sections
Adds the same logic used in debug/elf to load DWARF5 sections. For #49590 Fixes #50721 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> (cherry picked from commit 6c36c332fefdd433cfe6e6468a2542fc310e9f8a) Reviewed-on: https://go-review.googlesource.com/c/go/+/379915 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
This commit is contained in:
parent
07ee9e6445
commit
355915ba91
@ -650,10 +650,14 @@ func (f *File) DWARF() (*dwarf.Data, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for DWARF4 .debug_types sections.
|
// Look for DWARF4 .debug_types sections and DWARF5 sections.
|
||||||
for i, s := range f.Sections {
|
for i, s := range f.Sections {
|
||||||
suffix := dwarfSuffix(s)
|
suffix := dwarfSuffix(s)
|
||||||
if suffix != "types" {
|
if suffix == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, ok := dat[suffix]; ok {
|
||||||
|
// Already handled.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +666,11 @@ func (f *File) DWARF() (*dwarf.Data, error) {
|
|||||||
return nil, err
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -267,10 +267,14 @@ func (f *File) DWARF() (*dwarf.Data, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for DWARF4 .debug_types sections.
|
// Look for DWARF4 .debug_types sections and DWARF5 sections.
|
||||||
for i, s := range f.Sections {
|
for i, s := range f.Sections {
|
||||||
suffix := dwarfSuffix(s)
|
suffix := dwarfSuffix(s)
|
||||||
if suffix != "types" {
|
if suffix == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, ok := dat[suffix]; ok {
|
||||||
|
// Already handled.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +283,11 @@ func (f *File) DWARF() (*dwarf.Data, error) {
|
|||||||
return nil, err
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user