stop traceback when pc leaves text segment

SVN=127088
This commit is contained in:
Rob Pike 2008-07-14 16:00:44 -07:00
parent 4ce3065e63
commit bad8c3d5dd
1 changed files with 4 additions and 0 deletions

View 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'){