Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(456)

Unified Diff: src/pkg/runtime/panic.c

Issue 6441097: runtime: improved scheduler (Closed)
Patch Set: diff -r 107e46216b58 https://dvyukov%40google.com@code.google.com/p/go/ Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/runtime/mheap.c ('k') | src/pkg/runtime/proc.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/runtime/panic.c
===================================================================
--- a/src/pkg/runtime/panic.c
+++ b/src/pkg/runtime/panic.c
@@ -362,10 +362,30 @@
}
void
+runtime·dumpcurrentstack(void)
+{
+ uintptr pcs[16];
+ int32 n, l, i;
+ Func *f;
+
+ n = runtime·callers(1, pcs, nelem(pcs));
+ for(i=0; i<n; i++) {
+ f = runtime·findfunc(pcs[i]);
+ if(f == nil)
+ break;
+ l = runtime·funcline(f, pcs[i]);
+ runtime·printf(" #%d: %p %S %S:%d\n", i, pcs[i], f->name, f->src, l);
+ }
+}
+
+void
runtime·throw(int8 *s)
{
+ if(m->mcache == nil)
+ m->mcache = runtime·allocmcache();
runtime·startpanic();
runtime·printf("throw: %s\n", s);
+ runtime·dumpcurrentstack();
runtime·dopanic(0);
*(int32*)0 = 0; // not reached
runtime·exit(1); // even more not reached
« no previous file with comments | « src/pkg/runtime/mheap.c ('k') | src/pkg/runtime/proc.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b