From: Dan Kortschak Date: Sun, 29 Aug 2021 04:31:03 +0000 (+0930) Subject: debug/plan9obj: export ErrNoSymbols X-Git-Tag: go1.18beta1~492 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=58ec92527041f88d427390a92619cd9a927b6aba;p=gostls13.git 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 Reviewed-by: Ian Lance Taylor Reviewed-by: Cherry Mui --- diff --git a/src/debug/plan9obj/file.go b/src/debug/plan9obj/file.go index 314608da61..c054635148 100644 --- a/src/debug/plan9obj/file.go +++ b/src/debug/plan9obj/file.go @@ -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()