Applied Russ Cox's CPU panic debug patch from Oct 2003.
This commit is contained in:
parent
f2b7a065cd
commit
ae66bb33c0
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dbg_main.cc,v 1.3 2004-01-04 13:13:45 cbothamy Exp $
|
||||
// $Id: dbg_main.cc,v 1.4 2004-01-17 08:36:29 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1872,7 +1872,7 @@ bx_dbg_continue_command(void)
|
||||
// set stop flag if a guard found other than icount or halted
|
||||
unsigned long found = BX_CPU(cpu)->guard_found.guard_found;
|
||||
stop_reason_t reason = (stop_reason_t) BX_CPU(cpu)->stop_reason;
|
||||
if (found & BX_DBG_GUARD_ICOUNT) {
|
||||
if (found == BX_DBG_GUARD_ICOUNT) {
|
||||
// I expected this guard, don't stop
|
||||
} else if (found!=0) {
|
||||
stop = 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: debug.h,v 1.1 2003-11-28 15:07:25 danielg4 Exp $
|
||||
// $Id: debug.h,v 1.2 2004-01-17 08:36:29 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -192,7 +192,9 @@ extern int num_read_watchpoints;
|
||||
extern Bit32u read_watchpoint[MAX_READ_WATCHPOINTS];
|
||||
|
||||
typedef enum {
|
||||
STOP_NO_REASON = 0, STOP_TIME_BREAK_POINT, STOP_READ_WATCH_POINT, STOP_WRITE_WATCH_POINT, STOP_MAGIC_BREAK_POINT, UNUSED_STOP_TRACE, STOP_MODE_BREAK_POINT, STOP_CPU_HALTED
|
||||
STOP_NO_REASON = 0, STOP_TIME_BREAK_POINT, STOP_READ_WATCH_POINT,
|
||||
STOP_WRITE_WATCH_POINT, STOP_MAGIC_BREAK_POINT, UNUSED_STOP_TRACE,
|
||||
STOP_MODE_BREAK_POINT, STOP_CPU_HALTED, STOP_CPU_PANIC
|
||||
} stop_reason_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.81 2003-10-09 19:05:11 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.82 2004-01-17 08:36:29 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -127,6 +127,11 @@ BX_CPU_C::cpu_loop(Bit32s max_instr_count)
|
||||
// only from exception function can we get here ...
|
||||
BX_INSTR_NEW_INSTRUCTION(BX_CPU_ID);
|
||||
}
|
||||
#elif BX_GDBSTUB
|
||||
if (setjmp( BX_CPU_THIS_PTR jmp_buf_env ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else
|
||||
(void) setjmp( BX_CPU_THIS_PTR jmp_buf_env );
|
||||
#endif
|
||||
@ -136,6 +141,7 @@ BX_CPU_C::cpu_loop(Bit32s max_instr_count)
|
||||
// the debugger may request that control is returned to it so that
|
||||
// the situation may be examined.
|
||||
if (bx_guard.special_unwind_stack) {
|
||||
printf("CPU_LOOP %d\n", bx_guard.special_unwind_stack);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.155 2003-12-30 22:12:45 cbothamy Exp $
|
||||
// $Id: cpu.h,v 1.156 2004-01-17 08:36:29 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1380,6 +1380,10 @@ union {
|
||||
bx_guard_found_t guard_found;
|
||||
#endif
|
||||
|
||||
#if BX_GDBSTUB
|
||||
Bit8u ispanic;
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
#define TLB_GENERATION_MAX (BX_TLB_SIZE-1)
|
||||
#endif
|
||||
|
@ -367,7 +367,13 @@ static void debug_loop(void)
|
||||
}
|
||||
|
||||
stub_trace_flag = 0;
|
||||
bx_cpu.ispanic = 0;
|
||||
bx_cpu.cpu_loop(-1);
|
||||
if (bx_cpu.ispanic)
|
||||
{
|
||||
last_stop_reason = GDBSTUB_EXECUTION_BREAKPOINT;
|
||||
}
|
||||
|
||||
DEV_vga_refresh();
|
||||
|
||||
if (buffer[1] != 0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: textconfig.cc,v 1.18 2003-10-24 15:39:57 vruppert Exp $
|
||||
// $Id: textconfig.cc,v 1.19 2004-01-17 08:36:29 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is code for a text-mode configuration interface. Note that this file
|
||||
@ -623,7 +623,7 @@ int bx_write_rc (char *rc)
|
||||
}
|
||||
|
||||
char *log_action_ask_choices[] = { "cont", "alwayscont", "die", "abort", "debug" };
|
||||
int log_action_n_choices = 4 + (BX_DEBUGGER?1:0);
|
||||
int log_action_n_choices = 4 + (BX_DEBUGGER||BX_GDBSTUB?1:0);
|
||||
|
||||
BxEvent *
|
||||
config_interface_notify_callback (void *unused, BxEvent *event)
|
||||
@ -680,6 +680,10 @@ config_interface_notify_callback (void *unused, BxEvent *event)
|
||||
#if BX_DEBUGGER
|
||||
fprintf (stderr, " debug - continue and return to bochs debugger\n");
|
||||
#endif
|
||||
#if BX_GDBSTUB
|
||||
fprintf (stderr, " debug - hand control to gdb\n");
|
||||
#endif
|
||||
|
||||
int choice;
|
||||
ask:
|
||||
if (ask_menu ("Choose one of the actions above: [%s] ",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: logio.cc,v 1.42 2003-08-24 10:30:07 cbothamy Exp $
|
||||
// $Id: logio.cc,v 1.43 2004-01-17 08:36:29 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -514,6 +514,24 @@ logfunctions::ask (int level, const char *prefix, const char *fmt, va_list ap)
|
||||
// instruction, it should notice the user interrupt and return to
|
||||
// the debugger.
|
||||
bx_guard.interrupt_requested = 1;
|
||||
|
||||
// actually, if this is a panic, it's very likely the caller will
|
||||
// not be able to cope gracefully if we return and try to keep
|
||||
// executing. so longjmp back to the cpu loop immediately.
|
||||
if (level == LOGLEV_PANIC) {
|
||||
BX_CPU_THIS_PTR stop_reason = STOP_CPU_PANIC;
|
||||
bx_guard.special_unwind_stack = 1;
|
||||
in_ask_already = 0;
|
||||
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if BX_GDBSTUB
|
||||
case BX_LOG_ASK_CHOICE_ENTER_DEBUG:
|
||||
// user chose debugger (we're using gdb)
|
||||
in_ask_already = 0;
|
||||
BX_CPU_THIS_PTR ispanic = 1;
|
||||
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user