diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-07-27 22:27:54 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-08-01 11:21:40 -0700 |
commit | f75af8c1464e948b5e166cf5ab09ebf0d82fc253 (patch) | |
tree | 3ba3299859b504bdeb477727471216bd094a0191 /libgo/go/runtime/debuglog.go | |
parent | 75a23e59031fe673fc3b2e60fd1fe5f4c70ecb85 (diff) | |
download | gcc-f75af8c1464e948b5e166cf5ab09ebf0d82fc253.zip gcc-f75af8c1464e948b5e166cf5ab09ebf0d82fc253.tar.gz gcc-f75af8c1464e948b5e166cf5ab09ebf0d82fc253.tar.bz2 |
libgo: update to go1.15rc1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/245157
Diffstat (limited to 'libgo/go/runtime/debuglog.go')
-rw-r--r-- | libgo/go/runtime/debuglog.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libgo/go/runtime/debuglog.go b/libgo/go/runtime/debuglog.go index 404d057..d8c87c7 100644 --- a/libgo/go/runtime/debuglog.go +++ b/libgo/go/runtime/debuglog.go @@ -672,13 +672,17 @@ func (r *debugLogReader) printVal() bool { print("..(", r.uvarint(), " more bytes)..") case debugLogPC: - printDebugLogPC(uintptr(r.uvarint())) + printDebugLogPC(uintptr(r.uvarint()), false) case debugLogTraceback: n := int(r.uvarint()) for i := 0; i < n; i++ { print("\n\t") - printDebugLogPC(uintptr(r.uvarint())) + // gentraceback PCs are always return PCs. + // Convert them to call PCs. + // + // TODO(austin): Expand inlined frames. + printDebugLogPC(uintptr(r.uvarint()), true) } } @@ -801,9 +805,18 @@ func printDebugLog() { printunlock() } -func printDebugLogPC(pc uintptr) { - print(hex(pc)) +// printDebugLogPC prints a single symbolized PC. If returnPC is true, +// pc is a return PC that must first be converted to a call PC. +func printDebugLogPC(pc uintptr, returnPC bool) { name, file, line, _ := funcfileline(pc, -1, false) + entry := funcentry(pc) + if returnPC && (name == "" || (entry != 0 && pc > funcentry(pc))) { + // TODO(austin): Don't back up if the previous frame + // was a sigpanic. + pc-- + } + + print(hex(pc)) if name == "" { print(" [unknown PC]") } else { |