traceback(byte *pc0, byte *sp, G *g)
{
Stktop *stk;
- uintptr pc;
+ uintptr pc, tracepc;
int32 i, n;
Func *f;
byte *p;
sp = stk->gobuf.sp;
stk = (Stktop*)stk->stackbase;
}
- p = (byte*)pc;
+ p = (byte*)pc;
+ tracepc = pc;
if(n > 0 && pc != (uint64)goexit)
- pc--; // get to CALL instruction
- f = findfunc(pc);
+ tracepc--; // get to CALL instruction
+ f = findfunc(tracepc);
if(f == nil) {
// dangerous, but poke around to see if it is a closure
// ADDL $xxx, SP; RET
printf("%S", f->name);
if(pc > f->entry)
printf("+%p", (uintptr)(pc - f->entry));
- printf(" %S:%d\n", f->src, funcline(f, pc));
+ printf(" %S:%d\n", f->src, funcline(f, tracepc));
printf("\t%S(", f->name);
for(i = 0; i < f->args; i++) {
if(i != 0)
traceback(byte *pc0, byte *sp, G *g)
{
Stktop *stk;
- uint64 pc;
+ uint64 pc, tracepc;
int32 i, n;
Func *f;
byte *p;
sp = stk->gobuf.sp;
stk = (Stktop*)stk->stackbase;
}
- p = (byte*)pc;
+ p = (byte*)pc;
+ tracepc = pc; // used for line number, function
if(n > 0 && pc != (uint64)goexit)
- pc--; // get to CALL instruction
- f = findfunc(pc);
+ tracepc--; // get to CALL instruction
+ f = findfunc(tracepc);
if(f == nil) {
// dangerous, but poke around to see if it is a closure
// ADDQ $xxx, SP; RET
printf("%S", f->name);
if(pc > f->entry)
printf("+%p", (uintptr)(pc - f->entry));
- printf(" %S:%d\n", f->src, funcline(f, pc));
+ printf(" %S:%d\n", f->src, funcline(f, tracepc));
printf("\t%S(", f->name);
for(i = 0; i < f->args; i++) {
if(i != 0)