Reviewers: golang-dev_googlegroups.com,
Message:
Hello [email protected],
I'd like you to review this change to
https://go.googlecode.com/hg/
Description:
runtime: display go version and operating system information in panic
message
Fixes issue 4492.
throw: all goroutines are asleep - deadlock!
Go runtime version: devel +a32219a715c5 Wed Dec 05 15:26:18 2012 +1100
linux/amd64
goroutine 1 [select (no cases)]:
main.main()
/home/dfc/src/panic.go:3 +0x18
goroutine 2 [syscall]:
created by runtime.main
/home/dfc/go/src/pkg/runtime/proc.c:225
exit status 2
Please review this at https://codereview.appspot.com/6875063/
Affected files:
M src/pkg/runtime/extern.go
M src/pkg/runtime/panic.c
Index: src/pkg/runtime/extern.go
===================================================================
--- a/src/pkg/runtime/extern.go
+++ b/src/pkg/runtime/extern.go
@@ -139,3 +139,6 @@
// GOARCH is the running program's architecture target:
// 386, amd64, or arm.
const GOARCH string = theGoarch
+
+// panicvers is printed by panic
+var panicvers = "Go runtime version: " + theVersion + " " + GOOS + "/" +
GOARCH + "\n"
Index: src/pkg/runtime/panic.c
===================================================================
--- a/src/pkg/runtime/panic.c
+++ b/src/pkg/runtime/panic.c
@@ -301,6 +301,8 @@
runtime·lock(&paniclk);
}
+extern String runtime·panicvers; // defined in extern.go
+
void
runtime·dopanic(int32 unused)
{
@@ -310,6 +312,7 @@
runtime·printf("[signal %x code=%p addr=%p pc=%p]\n",
g->sig, g->sigcode0, g->sigcode1, g->sigpc);
+ runtime·printstring(runtime·panicvers);
if(runtime·gotraceback()){
if(g != m->g0) {
runtime·printf("\n");