From: Russ Cox Date: Fri, 22 Oct 2010 21:04:32 +0000 (-0400) Subject: runtime: print unknown types in panic X-Git-Tag: weekly.2010-10-27~39 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1dd0319be36ae0b00d14caeb13912c1cc2f13d1f;p=gostls13.git runtime: print unknown types in panic R=r CC=golang-dev https://golang.org/cl/2683041 --- diff --git a/src/pkg/runtime/error.go b/src/pkg/runtime/error.go index 673e77b2c1..289d78f49f 100644 --- a/src/pkg/runtime/error.go +++ b/src/pkg/runtime/error.go @@ -111,6 +111,8 @@ type stringer interface { String() string } +func typestring(interface{}) string + // For calling from C. // Prints an argument passed to panic. // There's room for arbitrary complexity here, but we keep it @@ -126,6 +128,6 @@ func printany(i interface{}) { case string: print(v) default: - print(i) + print("(", typestring(i), ") ", i) } } diff --git a/src/pkg/runtime/print.c b/src/pkg/runtime/print.c index aa207e3124..cf37886183 100644 --- a/src/pkg/runtime/print.c +++ b/src/pkg/runtime/print.c @@ -348,3 +348,11 @@ void { write(fd, "\n", 1); } + +void +·typestring(Eface e, String s) +{ + s = *e.type->string; + FLUSH(&s); +} +