1
0
mirror of https://github.com/golang/go synced 2024-11-25 12:57:58 -07:00

improved formatting of traceback

SVN=123527
This commit is contained in:
Rob Pike 2008-06-18 23:25:37 -07:00
parent d6f25597bb
commit 1a2421e406

View File

@ -110,6 +110,7 @@ sys_panicl(int32 lno)
int8* spp; int8* spp;
int32 counter; int32 counter;
int32 i; int32 i;
int8* name;
prints("\npanic on line "); prints("\npanic on line ");
sys_printint(lno); sys_printint(lno);
@ -119,18 +120,29 @@ sys_panicl(int32 lno)
sp = (uint8*)&lno; sp = (uint8*)&lno;
pc = (uint8*)sys_panicl; pc = (uint8*)sys_panicl;
counter = 0; counter = 0;
name = "panic";
while((pc = ((uint8**)sp)[-1]) > (uint8*)0x1000) { while((pc = ((uint8**)sp)[-1]) > (uint8*)0x1000) {
/* print args for this frame */
prints("\t");
prints(name);
prints("(");
for(i = 0; i < 3; i++){ for(i = 0; i < 3; i++){
prints("\tint32["); if(i != 0)
sys_printint(i); prints(", ");
prints("]=");
sys_printint(((uint32*)sp)[i]); sys_printint(((uint32*)sp)[i]);
prints("\tint64*[");
sys_printint(i);
prints("]=");
sys_printpointer(((void**)sp)[i]);
prints("\n");
} }
prints(", ...)\n");
prints("\t");
prints(name);
prints("(");
for(i = 0; i < 3; i++){
if(i != 0)
prints(", ");
prints("0x");
sys_printpointer(((void**)sp)[i]);
}
prints(", ...)\n");
/* print pc for next frame */
prints("0x"); prints("0x");
sys_printpointer(pc); sys_printpointer(pc);
prints(" "); prints(" ");
@ -144,7 +156,8 @@ sys_panicl(int32 lno)
spoff = *pc++; spoff = *pc++;
spoff += *pc++ << 8; spoff += *pc++ << 8;
spoff += *pc++ << 16; spoff += *pc++ << 16;
prints((int8*)pc); name = (int8*)pc;
prints(name);
prints("+"); prints("+");
sys_printint(pc-retpc); sys_printint(pc-retpc);
prints("?zi\n"); prints("?zi\n");