]> Cypherpunks repositories - gostls13.git/commitdiff
in traceback, handle the case where we've called through a nil function pointer
authorRob Pike <r@golang.org>
Mon, 3 Nov 2008 23:22:15 +0000 (15:22 -0800)
committerRob Pike <r@golang.org>
Mon, 3 Nov 2008 23:22:15 +0000 (15:22 -0800)
R=rsc
DELTA=7  (7 added, 0 deleted, 0 changed)
OCL=18372
CL=18372

src/runtime/rt2_amd64.c

index 91bef5434068092b0d4a57c85269ea34a516bfc1..a3433678b2c011a524cc46791c483c563f6a432c 100644 (file)
@@ -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(;;){