mirror of
https://github.com/golang/go
synced 2024-11-17 14:44:44 -07:00
debug/elf: retain original error message when getSymbols fails.
The original error is currently discarded, and that makes it difficult to know what failed, in case we want to retry only certain errors. Change-Id: Id7e927ec242464249c4dfa5cda0f264adef3c898 Reviewed-on: https://go-review.googlesource.com/c/go/+/317851 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
5a4b9f9494
commit
1bf2cd1291
@ -494,7 +494,7 @@ func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) {
|
|||||||
|
|
||||||
data, err := symtabSection.Data()
|
data, err := symtabSection.Data()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.New("cannot load symbol section")
|
return nil, nil, fmt.Errorf("cannot load symbol section: %w", err)
|
||||||
}
|
}
|
||||||
symtab := bytes.NewReader(data)
|
symtab := bytes.NewReader(data)
|
||||||
if symtab.Len()%Sym32Size != 0 {
|
if symtab.Len()%Sym32Size != 0 {
|
||||||
@ -503,7 +503,7 @@ func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) {
|
|||||||
|
|
||||||
strdata, err := f.stringTable(symtabSection.Link)
|
strdata, err := f.stringTable(symtabSection.Link)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.New("cannot load string table section")
|
return nil, nil, fmt.Errorf("cannot load string table section: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first entry is all zeros.
|
// The first entry is all zeros.
|
||||||
@ -537,7 +537,7 @@ func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) {
|
|||||||
|
|
||||||
data, err := symtabSection.Data()
|
data, err := symtabSection.Data()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.New("cannot load symbol section")
|
return nil, nil, fmt.Errorf("cannot load symbol section: %w", err)
|
||||||
}
|
}
|
||||||
symtab := bytes.NewReader(data)
|
symtab := bytes.NewReader(data)
|
||||||
if symtab.Len()%Sym64Size != 0 {
|
if symtab.Len()%Sym64Size != 0 {
|
||||||
@ -546,7 +546,7 @@ func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) {
|
|||||||
|
|
||||||
strdata, err := f.stringTable(symtabSection.Link)
|
strdata, err := f.stringTable(symtabSection.Link)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.New("cannot load string table section")
|
return nil, nil, fmt.Errorf("cannot load string table section: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first entry is all zeros.
|
// The first entry is all zeros.
|
||||||
|
Loading…
Reference in New Issue
Block a user