]> Cypherpunks repositories - gostls13.git/commitdiff
Don't try to account for CALL instruction in 0th frame.
authorAustin Clements <aclements@csail.mit.edu>
Fri, 14 Aug 2009 01:10:38 +0000 (18:10 -0700)
committerAustin Clements <aclements@csail.mit.edu>
Fri, 14 Aug 2009 01:10:38 +0000 (18:10 -0700)
R=rsc
APPROVED=rsc
DELTA=9  (4 added, 3 deleted, 2 changed)
OCL=33238
CL=33251

src/pkg/runtime/386/traceback.c
src/pkg/runtime/amd64/traceback.c

index 22a1bee5d7dfc3634d6b8ad687dfca2c7a0a942a..e4eb0c0841f85ff525147c1909db01524d133189 100644 (file)
@@ -60,7 +60,9 @@ traceback(byte *pc0, byte *sp, G *g)
                printf("%S", f->name);
                if(pc > f->entry)
                        printf("+%p", (uintptr)(pc - f->entry));
-               printf(" %S:%d\n", f->src, funcline(f, pc-1));  // -1 to get to CALL instr.
+               if(n > 0)
+                       pc--;   // get to CALL instruction
+               printf(" %S:%d\n", f->src, funcline(f, pc));
                printf("\t%S(", f->name);
                for(i = 0; i < f->args; i++) {
                        if(i != 0)
@@ -144,4 +146,3 @@ runtime·Caller(int32 n, uintptr retpc, String retfile, int32 retline, bool retb
        FLUSH(&retline);
        FLUSH(&retbool);
 }
-
index df4e787a756a5deedbeb48d3c8c88763c52bb894..81310396f29a27def9667bc076ce2031db172749 100644 (file)
@@ -57,7 +57,9 @@ traceback(byte *pc0, byte *sp, G *g)
                printf("%S", f->name);
                if(pc > f->entry)
                        printf("+%p", (uintptr)(pc - f->entry));
-               printf(" %S:%d\n", f->src, funcline(f, pc-1));  // -1 to get to CALL instr.
+               if(n > 0)
+                       pc--;   // get to CALL instruction
+               printf(" %S:%d\n", f->src, funcline(f, pc));
                printf("\t%S(", f->name);
                for(i = 0; i < f->args; i++) {
                        if(i != 0)
@@ -141,5 +143,3 @@ runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbo
        FLUSH(&retline);
        FLUSH(&retbool);
 }
-
-