aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorDan Kortschak <dan@kortschak.io>2021-08-29 14:01:03 +0930
committerIan Lance Taylor <iant@golang.org>2021-11-05 21:27:19 +0000
commit58ec92527041f88d427390a92619cd9a927b6aba (patch)
treeb50b1515c742cbcb33ab562cef59bdc631559f24 /src/debug
parent3e9e02412e7770e46c7e725e17dee09a7d79f32c (diff)
downloadgo-58ec92527041f88d427390a92619cd9a927b6aba.tar.gz
go-58ec92527041f88d427390a92619cd9a927b6aba.zip
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>
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/plan9obj/file.go6
1 files changed, 5 insertions, 1 deletions
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()