mirror of
https://github.com/golang/go
synced 2024-09-24 19:30:12 -06:00
debug/plan9obj: export ErrNoSymbols
This allows callers of *File.Symbols to distinguish absence of symbols from other errors as can already by done in debug/elf. Fixes #48052 Change-Id: I5ba15d8473911e516c016a69c1f1c710f7fc4cd5 Reviewed-on: https://go-review.googlesource.com/c/go/+/350229 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
3e9e02412e
commit
58ec925270
@ -301,11 +301,15 @@ func newTable(symtab []byte, ptrsz int) ([]Sym, error) {
|
||||
return syms, nil
|
||||
}
|
||||
|
||||
// ErrNoSymbols is returned by File.Symbols if there is no such section
|
||||
// in the File.
|
||||
var ErrNoSymbols = errors.New("no symbol section")
|
||||
|
||||
// Symbols returns the symbol table for f.
|
||||
func (f *File) Symbols() ([]Sym, error) {
|
||||
symtabSection := f.Section("syms")
|
||||
if symtabSection == nil {
|
||||
return nil, errors.New("no symbol section")
|
||||
return nil, ErrNoSymbols
|
||||
}
|
||||
|
||||
symtab, err := symtabSection.Data()
|
||||
|
Loading…
Reference in New Issue
Block a user