Commit 1a2421e4 authored by Rob Pike's avatar Rob Pike

improved formatting of traceback

SVN=123527
parent d6f25597
...@@ -110,6 +110,7 @@ sys_panicl(int32 lno) ...@@ -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) ...@@ -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(", ...)\n");
prints("]="); prints("\t");
prints(name);
prints("(");
for(i = 0; i < 3; i++){
if(i != 0)
prints(", ");
prints("0x");
sys_printpointer(((void**)sp)[i]); sys_printpointer(((void**)sp)[i]);
prints("\n");
} }
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) ...@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment