aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/panic.c
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2014-07-18 16:30:38 +1000
committerDave Cheney <dave@cheney.net>2014-07-18 16:30:38 +1000
commitec5d7ba95c4ae49517f832644979ecbefdf657cc (patch)
tree2d0abc5a7dc5bd371c17fa31ea01da0080fc1937 /src/pkg/runtime/panic.c
parentf378f300345431204d5842751db2add7994d9957 (diff)
downloadgo-ec5d7ba95c4ae49517f832644979ecbefdf657cc.tar.xz
runtime: add throwgo
Fixes #8380. Also update hashmap.go to use throwgo rather than panic. LGTM=khr R=khr, rsc CC=golang-codereviews https://golang.org/cl/115860045
Diffstat (limited to 'src/pkg/runtime/panic.c')
-rw-r--r--src/pkg/runtime/panic.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c
index 8225df7db7..ce05725037 100644
--- a/src/pkg/runtime/panic.c
+++ b/src/pkg/runtime/panic.c
@@ -525,6 +525,18 @@ runtime·throw(int8 *s)
}
void
+runtime·throwgo(String s)
+{
+ if(g->m->throwing == 0)
+ g->m->throwing = 1;
+ runtime·startpanic();
+ runtime·printf("fatal error: %S\n", s);
+ runtime·dopanic(0);
+ *(int32*)0 = 0; // not reached
+ runtime·exit(1); // even more not reached
+}
+
+void
runtime·panicstring(int8 *s)
{
Eface err;