From: Rob Pike Date: Mon, 14 Jul 2008 23:00:44 +0000 (-0700) Subject: stop traceback when pc leaves text segment X-Git-Tag: weekly.2009-11-06~3503 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bad8c3d5dd57086b5c971271fc049976748feb1f;p=gostls13.git stop traceback when pc leaves text segment SVN=127088 --- diff --git a/src/runtime/rt2_amd64.c b/src/runtime/rt2_amd64.c index a5f5d109a9..91bef54340 100644 --- a/src/runtime/rt2_amd64.c +++ b/src/runtime/rt2_amd64.c @@ -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'){