diff options
author | Russ Cox <rsc@golang.org> | 2008-11-23 17:08:55 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-11-23 17:08:55 -0800 |
commit | dd4aebb84ab8ee8dd11b12a7802a02373fabac6c (patch) | |
tree | 7844c561a0e97cefebaae40c6fc9e60acd59628f /src/runtime/rt2_amd64.c | |
parent | 90aa232ac15839303847e28b1bc0747b5e9cc114 (diff) | |
download | golang-dd4aebb84ab8ee8dd11b12a7802a02373fabac6c.tar.gz |
delete stack mark strings
in favor of using in-memory copy of symbol table.
$ ls -l pretty pretty.big
-rwxr-xr-x 1 rsc eng 439516 Nov 21 16:43 pretty
-rwxr-xr-x 1 rsc eng 580984 Nov 21 16:20 pretty.big
$
R=r
DELTA=446 (238 added, 178 deleted, 30 changed)
OCL=19851
CL=19884
Diffstat (limited to 'src/runtime/rt2_amd64.c')
-rw-r--r-- | src/runtime/rt2_amd64.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/runtime/rt2_amd64.c b/src/runtime/rt2_amd64.c index 38eeddb49..5a388bfe0 100644 --- a/src/runtime/rt2_amd64.c +++ b/src/runtime/rt2_amd64.c @@ -6,8 +6,6 @@ extern int32 debug; -static int8 spmark[] = "\xa7\xf1\xd9\x2a\x82\xc8\xd8\xfe"; - extern uint8 end; void @@ -18,7 +16,8 @@ traceback(uint8 *pc, uint8 *sp, void* r15) uint8* callpc; int32 counter; int32 i; - int8* name; + string name; + Func *f; G g; Stktop *stktop; @@ -33,7 +32,7 @@ traceback(uint8 *pc, uint8 *sp, void* r15) } counter = 0; - name = "panic"; + name = gostring((byte*)"panic"); for(;;){ callpc = pc; if((uint8*)retfromnewstack == pc) { @@ -46,21 +45,11 @@ traceback(uint8 *pc, uint8 *sp, void* r15) sp += 16; // two irrelevant calls on stack - morestack, plus the call morestack made continue; } - /* 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'){ - spoff = *pc++; - spoff += *pc++ << 8; - spoff += *pc++ << 16; - name = (int8*)pc; - sp += spoff + 8; - break; - } - } + f = findfunc((uint64)callpc); + if(f == nil) + return; + name = f->name; + sp += f->frame; if(counter++ > 100){ prints("stack trace terminated\n"); break; @@ -73,7 +62,7 @@ traceback(uint8 *pc, uint8 *sp, void* r15) sys·printpointer(callpc - 1); // -1 to get to CALL instr. prints("?zi\n"); prints("\t"); - prints(name); + sys·printstring(name); prints("("); for(i = 0; i < 3; i++){ if(i != 0) @@ -82,7 +71,7 @@ traceback(uint8 *pc, uint8 *sp, void* r15) } prints(", ...)\n"); prints("\t"); - prints(name); + sys·printstring(name); prints("("); for(i = 0; i < 3; i++){ if(i != 0) |