Commit 63f38d62 authored by Rob Pike's avatar Rob Pike

in traceback, handle the case where we've called through a nil function pointer

R=rsc
DELTA=7  (7 added, 0 deleted, 0 changed)
OCL=18372
CL=18372
parent 250ec166
...@@ -25,6 +25,13 @@ traceback(uint8 *pc, uint8 *sp, void* r15) ...@@ -25,6 +25,13 @@ traceback(uint8 *pc, uint8 *sp, void* r15)
// store local copy of per-process data block that we can write as we unwind // store local copy of per-process data block that we can write as we unwind
mcpy((byte*)&g, (byte*)r15, sizeof(G)); mcpy((byte*)&g, (byte*)r15, sizeof(G));
// if the PC is zero, it's probably due to a nil function pointer.
// pop the failed frame.
if(pc == nil) {
pc = ((uint8**)sp)[0];
sp += 8;
}
counter = 0; counter = 0;
name = "panic"; name = "panic";
for(;;){ for(;;){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment