]> Cypherpunks repositories - gostls13.git/commitdiff
stop traceback when pc leaves text segment
authorRob Pike <r@golang.org>
Mon, 14 Jul 2008 23:00:44 +0000 (16:00 -0700)
committerRob Pike <r@golang.org>
Mon, 14 Jul 2008 23:00:44 +0000 (16:00 -0700)
SVN=127088

src/runtime/rt2_amd64.c

index a5f5d109a9e6dd6bd58f41f080f87f0f7d4da651..91bef5434068092b0d4a57c85269ea34a516bfc1 100644 (file)
@@ -8,6 +8,8 @@ extern int32    debug;
 
 static int8 spmark[] = "\xa7\xf1\xd9\x2a\x82\xc8\xd8\xfe";
 
+extern uint8 end;
+
 void
 traceback(uint8 *pc, uint8 *sp, void* r15)
 {
@@ -39,6 +41,8 @@ traceback(uint8 *pc, uint8 *sp, void* r15)
                }
                /* find SP offset by stepping back through instructions to SP offset marker */
                while(pc > (uint8*)0x1000+sizeof spmark-1) {
+                       if(pc >= &end)
+                               return;
                        for(spp = spmark; *spp != '\0' && *pc++ == (uint8)*spp++; )
                                ;
                        if(*spp == '\0'){