1 diff -u bochs-2.2.6.orig/cpu/exception.cc bochs-2.2.6/cpu/exception.cc
2 --- bochs-2.2.6.orig/cpu/exception.cc
3 +++ bochs-2.2.6/cpu/exception.cc
4 @@ -841,6 +841,13 @@ void BX_CPU_C::exception(unsigned vector
6 BX_CPU_THIS_PTR errorno++;
7 if (BX_CPU_THIS_PTR errorno >= 3) {
9 + if (bx_dbg.gdbstub_enabled) {
10 + fprintf(stderr, "Triple fault: stopping for gdb\n");
11 + BX_CPU_THIS_PTR ispanic = 1;
12 + longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1);
15 #if BX_RESET_ON_TRIPLE_FAULT
16 BX_ERROR(("exception(): 3rd (%d) exception with no resolution, shutdown status is %02xh, resetting", vector, DEV_cmos_get_reg(0x0f)));
17 debug(BX_CPU_THIS_PTR prev_eip);
18 @@ -860,6 +867,13 @@ void BX_CPU_C::exception(unsigned vector
20 /* if 1st was a double fault (software INT?), then shutdown */
21 if ( (BX_CPU_THIS_PTR errorno==2) && (BX_CPU_THIS_PTR curr_exception[0]==BX_ET_DOUBLE_FAULT) ) {
23 + if (bx_dbg.gdbstub_enabled) {
24 + fprintf(stderr, "Triple fault: stopping for gdb\n");
25 + BX_CPU_THIS_PTR ispanic = 1;
26 + longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1);
29 #if BX_RESET_ON_TRIPLE_FAULT
30 BX_INFO(("exception(): triple fault encountered, shutdown status is %02xh, resetting", DEV_cmos_get_reg(0x0f)));
31 debug(BX_CPU_THIS_PTR prev_eip);
32 diff -u bochs-2.2.6.orig/gdbstub.cc bochs-2.2.6/gdbstub.cc
33 --- bochs-2.2.6.orig/gdbstub.cc
34 +++ bochs-2.2.6/gdbstub.cc
35 @@ -466,19 +466,19 @@ static void debug_loop(void)
37 BX_INFO (("stepping"));
43 BX_INFO (("stopped with %x", last_stop_reason));
45 - if (last_stop_reason == GDBSTUB_EXECUTION_BREAKPOINT ||
46 - last_stop_reason == GDBSTUB_TRACE)
47 + if (last_stop_reason == GDBSTUB_TRACE && !bx_cpu.ispanic)
49 write_signal(&buf[1], SIGTRAP);
53 - write_signal(&buf[1], SIGTRAP);
54 + write_signal(&buf[1], SIGSEGV);