diff --git a/bochs/bx_debug/dbg_main.cc b/bochs/bx_debug/dbg_main.cc index 7464e2ed8..1402902b1 100644 --- a/bochs/bx_debug/dbg_main.cc +++ b/bochs/bx_debug/dbg_main.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: dbg_main.cc,v 1.73 2006-06-22 16:44:37 sshwarts Exp $ +// $Id: dbg_main.cc,v 1.74 2006-06-22 19:53:58 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -486,6 +486,24 @@ void bx_debug_break() bx_guard.interrupt_requested = 1; } +void bx_dbg_exception(unsigned cpu, Bit8u vector, Bit16u error_code) +{ + if (BX_CPU(dbg_cpu)->trace || bx_dbg.exceptions) + { + dbg_printf("CPU %d: Exception 0x%02x occured (error_code=0x%04x)\n", + cpu, vector, error_code); + } +} + +void bx_dbg_interrupt(unsigned cpu, Bit8u vector, Bit16u error_code) +{ + if (BX_CPU(dbg_cpu)->trace || bx_dbg.interrupts) + { + dbg_printf("CPU %d: Interrupt 0x%02x occured (error_code=0x%04x)\n", + cpu, vector, error_code); + } +} + void bx_dbg_exit(int code) { BX_DEBUG(("dbg: before exit" )); diff --git a/bochs/bx_debug/debug.h b/bochs/bx_debug/debug.h index 3a6c37b4b..5e87ab2e8 100644 --- a/bochs/bx_debug/debug.h +++ b/bochs/bx_debug/debug.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: debug.h,v 1.27 2006-06-12 19:51:31 sshwarts Exp $ +// $Id: debug.h,v 1.28 2006-06-22 19:53:58 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -294,6 +294,9 @@ void bx_dbg_info_vga(void); void bx_dbg_print_help(void); void bx_dbg_calc_command(Bit64u value); void bx_dbg_dump_table(void); +void bx_dbg_exception(unsigned cpu, Bit8u vector, Bit16u error_code); +void bx_dbg_interrupt(unsigned cpu, Bit8u vector, Bit16u error_code); + int bx_dbg_show_symbolic(void); void bx_dbg_set_symbol_command(char *symbol, Bit32u val); char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base); diff --git a/bochs/cpu/exception.cc b/bochs/cpu/exception.cc index 5cfe658ce..320e89aed 100644 --- a/bochs/cpu/exception.cc +++ b/bochs/cpu/exception.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: exception.cc,v 1.82 2006-06-17 12:09:55 sshwarts Exp $ +// $Id: exception.cc,v 1.83 2006-06-22 19:53:58 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -769,6 +769,7 @@ void BX_CPU_C::interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code, Bi if (vector == 0x80) bx_dbg_linux_syscall(BX_CPU_ID); } #endif + bx_dbg_interrupt(BX_CPU_ID, vector, error_code); #endif BX_DEBUG(("interrupt(): vector = %u, INT = %u, EXT = %u", @@ -811,9 +812,12 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code, bx_bool is_INT) invalidate_prefetch_q(); UNUSED(is_INT); - BX_INSTR_EXCEPTION(BX_CPU_ID, vector); +#if BX_DEBUGGER + bx_dbg_exception(BX_CPU_ID, vector, error_code); +#endif + BX_DEBUG(("exception(0x%02X)", (unsigned) vector)); // if not initial error, restore previous register values from