Commit 4f30ec7f authored by Russ Cox's avatar Russ Cox

fix 386 log test

R=r
DELTA=13  (0 added, 1 deleted, 12 changed)
OCL=29928
CL=29943
parent 25ac4d07
......@@ -25,4 +25,4 @@ func Breakpoint()
// ascend, with 1 identifying the the caller of Caller. The return values report the
// program counter, file name, and line number within the file of the corresponding
// call. The boolean ok is false if it was not possible to recover the information.
func Caller(n int) (pc uint64, file string, line int, ok bool)
func Caller(n int) (pc uintptr, file string, line int, ok bool)
......@@ -80,11 +80,11 @@ traceback(byte *pc0, byte *sp, G *g)
prints("...\n");
}
// func caller(n int) (pc uint64, file string, line int, ok bool)
// func caller(n int) (pc uintptr, file string, line int, ok bool)
void
runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbool)
runtime·Caller(int32 n, uintptr retpc, String retfile, int32 retline, bool retbool)
{
uint64 pc;
uintptr pc;
byte *sp;
byte *p;
Stktop *stk;
......@@ -92,7 +92,7 @@ runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbo
// our caller's pc, sp.
sp = (byte*)&n;
pc = *(uint64*)(sp-8);
pc = *((uintptr*)sp - 1);
if((f = findfunc(pc)) == nil) {
error:
retpc = 0;
......@@ -109,27 +109,27 @@ runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbo
// now unwind n levels
stk = (Stktop*)g->stackbase;
while(n-- > 0) {
while(pc == (uint64)retfromnewstack) {
while(pc == (uintptr)retfromnewstack) {
sp = stk->oldsp;
stk = (Stktop*)stk->oldbase;
pc = *(uint64*)(sp+8);
sp += 16;
pc = *((uintptr*)sp + 1);
sp += 2*sizeof(uintptr);
}
if(f->frame < 8) // assembly functions lie
sp += 8;
if(f->frame < sizeof(uintptr)) // assembly functions lie
sp += sizeof(uintptr);
else
sp += f->frame;
loop:
pc = *(uint64*)(sp-8);
pc = *((uintptr*)sp - 1);
if(pc <= 0x1000 || (f = findfunc(pc)) == nil) {
// dangerous, but let's try this.
// see if it is a closure.
p = (byte*)pc;
// ADDL $xxx, SP; RET
if(p[0] == 0x81 && p[1] == 0xc4 && p[6] == 0xc3) {
sp += *(uint32*)(p+2) + 8;
sp += *(uint32*)(p+2) + sizeof(uintptr);
goto loop;
}
goto error;
......@@ -146,4 +146,3 @@ runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbo
FLUSH(&retbool);
}
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