]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix Caller crash on 386.
authorRuss Cox <rsc@golang.org>
Fri, 4 Dec 2009 01:24:14 +0000 (17:24 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 4 Dec 2009 01:24:14 +0000 (17:24 -0800)
Fixes #176.

R=r
https://golang.org/cl/166044

src/pkg/runtime/386/traceback.c

index febbb51d1e9fe848759ec923c520d7624f6efe4c..60359e19c322705e11e8ad76a282ee2fbcc4b6b0 100644 (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;
                        }