diff --git a/src/libsys/boards/denano/board.c b/src/libsys/boards/denano/board.c index 1e0df4f..9bd8b0a 100644 --- a/src/libsys/boards/denano/board.c +++ b/src/libsys/boards/denano/board.c @@ -8,6 +8,8 @@ #include "board.h" #include "../../regdef.h" +#define DEBUGGER gdb_stub + extern uart_if_t uart_if[]; #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) @@ -47,7 +49,7 @@ void dbg_uart_isr(struct xcptcontext *xcp) char c = *dbg_uart->pDATA; if (c == 3) { - gdb_stub(xcp); + DEBUGGER(xcp); } } } @@ -98,7 +100,14 @@ char dbg_getchar() void dbg_init() { - xcpt_register(EXC_BP, gdb_stub); + xcpt_register(EXC_ADEL, DEBUGGER); + xcpt_register(EXC_ADES, DEBUGGER); + xcpt_register(EXC_IBE, DEBUGGER); + xcpt_register(EXC_DBE, DEBUGGER); + xcpt_register(EXC_BP, DEBUGGER); + xcpt_register(EXC_RI, DEBUGGER); + xcpt_register(EXC_CPU, DEBUGGER); + xcpt_register(EXC_OV, DEBUGGER); } void board_init(void) diff --git a/src/libsys/gdb_stub.c b/src/libsys/gdb_stub.c index 75f971e..2d6a48a 100644 --- a/src/libsys/gdb_stub.c +++ b/src/libsys/gdb_stub.c @@ -402,6 +402,11 @@ hexToInt(char **ptr, unsigned long *intValue) return (numChars); } +int isBreak(unsigned long instr) +{ + return ((instr & 0xFC00003F) == 0x0000000D); +} + /* * This function does all command procesing for interfacing to gdb. It * returns 1 if you should skip the instruction at the trap address, 0 @@ -417,9 +422,11 @@ handle_exception (unsigned long *registers) unsigned long length; char *ptr; unsigned long *sp; - - // branch shadow - if (registers[CR] & 0x80000000) + + unsigned long *pAddr = (unsigned long *)registers[PC]; + + // is break + if (isBreak(*pAddr)) { registers[PC] += 4; }