summaryrefslogtreecommitdiff
path: root/src/runtime/traceback.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-18 20:35:36 -0400
committerRuss Cox <rsc@golang.org>2014-09-18 20:35:36 -0400
commit60ed96d8037f0c515b0cd1c8d5bd0c061c332778 (patch)
treebb88736920bf2127b21b5f15c8d137e9f0b4037f /src/runtime/traceback.go
parent14f5f7506edb404922490ad15b2e16e87f7d1fb7 (diff)
downloadgo-60ed96d8037f0c515b0cd1c8d5bd0c061c332778.tar.gz
runtime: show frames for exported runtime functions
The current Windows build failure happens because by default runtime frames are excluded from stack traces. Apparently the Windows breakpoint path dies with an ordinary panic, while the Unix path dies with a throw. Breakpoint is a strange function and I don't mind that it's a little different on the two operating systems. The panic squelches runtime frames but the throw shows them, because throw is considered something that shouldn't have happened at all, so as much detail as possible is wanted. The runtime exclusion is meant to prevents printing too much noise about internal runtime details. But exported functions are not internal details, so show exported functions. If the program dies because you called runtime.Breakpoint, it's okay to see that frame. This makes the Breakpoint test show Breakpoint in the stack trace no matter how it is handled. Should fix Windows build. Tested on Unix by changing Breakpoint to fault instead of doing a breakpoint. TBR=brainman CC=golang-codereviews https://codereview.appspot.com/143300043
Diffstat (limited to 'src/runtime/traceback.go')
-rw-r--r--src/runtime/traceback.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 9e95fa33d..a93c42186 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -499,7 +499,14 @@ func showframe(f *_func, gp *g) bool {
return true
}
- return traceback > 1 || f != nil && contains(name, ".") && !hasprefix(name, "runtime.")
+ return traceback > 1 || f != nil && contains(name, ".") && (!hasprefix(name, "runtime.") || isExportedRuntime(name))
+}
+
+// isExportedRuntime reports whether name is an exported runtime function.
+// It is only for runtime functions, so ASCII A-Z is fine.
+func isExportedRuntime(name string) bool {
+ const n = len("runtime.")
+ return len(name) > n && name[:n] == "runtime." && 'A' <= name[n] && name[n] <= 'Z'
}
var gStatusStrings = [...]string{