mirror of
https://github.com/golang/go
synced 2024-11-25 15:17:58 -07:00
safety checks, waiting for gri's real tracking of PC and SP
extant code is too fragile SVN=124223
This commit is contained in:
parent
7b409b30f2
commit
d4c2da409b
@ -64,7 +64,7 @@ TEXT sys_sigaction(SB),1,$-8
|
|||||||
CALL notok(SB)
|
CALL notok(SB)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT sigtramp(SB),1,$-24
|
TEXT sigtramp(SB),1,$24
|
||||||
MOVL DX,0(SP)
|
MOVL DX,0(SP)
|
||||||
MOVQ CX,8(SP)
|
MOVQ CX,8(SP)
|
||||||
MOVQ R8,16(SP)
|
MOVQ R8,16(SP)
|
||||||
|
@ -39,6 +39,7 @@ typedef struct sigaction {
|
|||||||
void
|
void
|
||||||
sighandler(int32 sig, siginfo* info, void** context) {
|
sighandler(int32 sig, siginfo* info, void** context) {
|
||||||
int32 i;
|
int32 i;
|
||||||
|
void *pc, *sp;
|
||||||
|
|
||||||
if(sig < 0 || sig >= NSIG){
|
if(sig < 0 || sig >= NSIG){
|
||||||
prints("Signal ");
|
prints("Signal ");
|
||||||
@ -46,14 +47,18 @@ sighandler(int32 sig, siginfo* info, void** context) {
|
|||||||
}else{
|
}else{
|
||||||
prints(sigtab[sig].name);
|
prints(sigtab[sig].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
prints("\nFaulting address: 0x");
|
prints("\nFaulting address: 0x");
|
||||||
sys_printpointer(info->si_addr);
|
sys_printpointer(info->si_addr);
|
||||||
prints("\nPC: 0x");
|
prints("\nPC: 0x");
|
||||||
sys_printpointer(((void**)((&sig)+1))[22]);
|
pc = ((void**)((&sig)+1))[22];
|
||||||
|
sys_printpointer(pc);
|
||||||
prints("\nSP: 0x");
|
prints("\nSP: 0x");
|
||||||
sys_printpointer(((void**)((&sig)+1))[13]);
|
sp = ((void**)((&sig)+1))[13];
|
||||||
|
sys_printpointer(sp);
|
||||||
prints("\n");
|
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);
|
sys_exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user