mirror of https://github.com/golang/go.git
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>
This commit is contained in:
parent
40effca7a1
commit
6c36c332fe
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,10 +272,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
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +288,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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue