aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2023-03-03 01:24:06 +1100
committerJoel Sing <joel@sing.id.au>2023-03-18 06:31:16 +0000
commit20e9b7f1b53d49fd66e0344b1d0d42d3cf5e47b6 (patch)
treeb861a135d32f1e723eef5c6f72df8ef993873822 /src/debug
parent6827f0d7722ae08cf25cf2212f78bfc6ab8bfd0d (diff)
downloadgo-20e9b7f1b53d49fd66e0344b1d0d42d3cf5e47b6.tar.xz
debug/dwarf: return ErrUnknownPC rather than nil on unknown PC
Currently, on e == nil or e.Tag == 0, SeekPC returns with a nil error. Instead, indicate that the PC is unknown. Change-Id: I9594296034e2df872e399bd800b00cb565c413c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/473695 Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/dwarf/entry.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/debug/dwarf/entry.go b/src/debug/dwarf/entry.go
index 5bb4297b48..f1215d2b01 100644
--- a/src/debug/dwarf/entry.go
+++ b/src/debug/dwarf/entry.go
@@ -975,9 +975,12 @@ func (r *Reader) SeekPC(pc uint64) (*Entry, error) {
u := &r.d.unit[unit]
r.b = makeBuf(r.d, u, "info", u.off, u.data)
e, err := r.Next()
- if err != nil || e == nil || e.Tag == 0 {
+ if err != nil {
return nil, err
}
+ if e == nil || e.Tag == 0 {
+ return nil, ErrUnknownPC
+ }
ranges, err := r.d.Ranges(e)
if err != nil {
return nil, err