mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-16 19:22:22 +03:00
Fixed Linux specific bug causing lack of stack overflow traces.
This commit is contained in:
parent
f8cb035962
commit
c85fd1fe35
12
v/loop.c
12
v/loop.c
@ -42,6 +42,14 @@ typedef enum {
|
|||||||
|
|
||||||
volatile u2_kill Sigcause; // reasons for exception
|
volatile u2_kill Sigcause; // reasons for exception
|
||||||
|
|
||||||
|
static void _lo_cont(void *arg1, void *arg2, void *arg3)
|
||||||
|
{
|
||||||
|
(void)(arg1);
|
||||||
|
(void)(arg2);
|
||||||
|
(void)(arg3);
|
||||||
|
siglongjmp(Signal_buf, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_lo_signal_handle_over(int emergency, stackoverflow_context_t scp)
|
_lo_signal_handle_over(int emergency, stackoverflow_context_t scp)
|
||||||
{
|
{
|
||||||
@ -60,7 +68,7 @@ _lo_signal_handle_over(int emergency, stackoverflow_context_t scp)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Sigcause = sig_overflow;
|
Sigcause = sig_overflow;
|
||||||
longjmp(Signal_buf, 1);
|
sigsegv_leave_handler(_lo_cont, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +337,7 @@ u2_lo_soft(u2_reck* rec_u, c3_w sec_w, u2_funk fun_f, u2_noun arg)
|
|||||||
u2_unix_ef_hold();
|
u2_unix_ef_hold();
|
||||||
_lo_signal_deep(sec_w);
|
_lo_signal_deep(sec_w);
|
||||||
|
|
||||||
if ( 0 != setjmp(Signal_buf) ) {
|
if ( 0 != sigsetjmp(Signal_buf, 1) ) {
|
||||||
u2_noun tax, pre, mok;
|
u2_noun tax, pre, mok;
|
||||||
|
|
||||||
// return to blank state
|
// return to blank state
|
||||||
|
12
v/main.c
12
v/main.c
@ -246,6 +246,14 @@ static uint8_t Sigstk[SIGSTKSZ];
|
|||||||
|
|
||||||
volatile enum { sig_none, sig_overflow, sig_interrupt } Sigcause;
|
volatile enum { sig_none, sig_overflow, sig_interrupt } Sigcause;
|
||||||
|
|
||||||
|
static void _main_cont(void *arg1, void *arg2, void *arg3)
|
||||||
|
{
|
||||||
|
(void)(arg1);
|
||||||
|
(void)(arg2);
|
||||||
|
(void)(arg3);
|
||||||
|
siglongjmp(Signal_buf, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
overflow_handler(int emergency, stackoverflow_context_t scp)
|
overflow_handler(int emergency, stackoverflow_context_t scp)
|
||||||
{
|
{
|
||||||
@ -254,7 +262,7 @@ overflow_handler(int emergency, stackoverflow_context_t scp)
|
|||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
Sigcause = sig_overflow;
|
Sigcause = sig_overflow;
|
||||||
longjmp(Signal_buf, 1);
|
sigsegv_leave_handler(_main_cont, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +375,7 @@ main(c3_i argc,
|
|||||||
// we get a signal, we force the system back into the just-booted state.
|
// we get a signal, we force the system back into the just-booted state.
|
||||||
// If anything goes wrong during boot (above), it's curtains.
|
// If anything goes wrong during boot (above), it's curtains.
|
||||||
{
|
{
|
||||||
if ( 0 != setjmp(Signal_buf) ) {
|
if ( 0 != sigsetjmp(Signal_buf, 1) ) {
|
||||||
switch ( Sigcause ) {
|
switch ( Sigcause ) {
|
||||||
case sig_overflow: printf("[stack overflow]\r\n"); break;
|
case sig_overflow: printf("[stack overflow]\r\n"); break;
|
||||||
case sig_interrupt: printf("[interrupt]\r\n"); break;
|
case sig_interrupt: printf("[interrupt]\r\n"); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user