Commit d4c2da40 authored by Rob Pike's avatar Rob Pike

safety checks, waiting for gri's real tracking of PC and SP

extant code is too fragile

SVN=124223
parent 7b409b30
......@@ -64,7 +64,7 @@ TEXT sys_sigaction(SB),1,$-8
CALL notok(SB)
RET
TEXT sigtramp(SB),1,$-24
TEXT sigtramp(SB),1,$24
MOVL DX,0(SP)
MOVQ CX,8(SP)
MOVQ R8,16(SP)
......
......@@ -39,6 +39,7 @@ typedef struct sigaction {
void
sighandler(int32 sig, siginfo* info, void** context) {
int32 i;
void *pc, *sp;
if(sig < 0 || sig >= NSIG){
prints("Signal ");
......@@ -46,14 +47,18 @@ sighandler(int32 sig, siginfo* info, void** context) {
}else{
prints(sigtab[sig].name);
}
prints("\nFaulting address: 0x");
sys_printpointer(info->si_addr);
prints("\nPC: 0x");
sys_printpointer(((void**)((&sig)+1))[22]);
pc = ((void**)((&sig)+1))[22];
sys_printpointer(pc);
prints("\nSP: 0x");
sys_printpointer(((void**)((&sig)+1))[13]);
sp = ((void**)((&sig)+1))[13];
sys_printpointer(sp);
prints("\n");
traceback(((void**)((&sig)+1))[22], ((void**)((&sig)+1))[13]); /* empirically discovered locations */
if (pc != 0 && sp != 0)
traceback(pc, sp); /* empirically discovered locations */
sys_exit(2);
}
......
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