From 63f38d62ac7807f47d69610cf559393569e3622f Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Mon, 3 Nov 2008 15:22:15 -0800 Subject: [PATCH] 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 --- src/runtime/rt2_amd64.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtime/rt2_amd64.c b/src/runtime/rt2_amd64.c index 91bef543406..a3433678b2c 100644 --- a/src/runtime/rt2_amd64.c +++ b/src/runtime/rt2_amd64.c @@ -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 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; name = "panic"; for(;;){