1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:04:41 -07:00

runtime: fix Caller crash on 386.

Fixes #176.

R=r
https://golang.org/cl/166044
This commit is contained in:
Russ Cox 2009-12-03 17:24:14 -08:00
parent 6301fb4134
commit cf37254b1c

View File

@ -42,7 +42,7 @@ traceback(byte *pc0, byte *sp, G *g)
if(f == nil) {
// dangerous, but poke around to see if it is a closure
// ADDL $xxx, SP; RET
if((uint64)pc > 0x1000 && p[0] == 0x81 && p[1] == 0xc4 && p[6] == 0xc3) {
if(pc > 0x1000 && p[0] == 0x81 && p[1] == 0xc4 && p[6] == 0xc3) {
sp += *(uint32*)(p+2) + 8;
pc = *(uintptr*)(sp - 8);
if(pc <= 0x1000)
@ -130,7 +130,7 @@ runtime·Caller(int32 n, uintptr retpc, String retfile, int32 retline, bool retb
// see if it is a closure.
p = (byte*)pc;
// ADDL $xxx, SP; RET
if(p[0] == 0x81 && p[1] == 0xc4 && p[6] == 0xc3) {
if(pc > 0x1000 && p[0] == 0x81 && p[1] == 0xc4 && p[6] == 0xc3) {
sp += *(uint32*)(p+2) + sizeof(uintptr);
goto loop;
}