From 19386ec2c8c9f266425453673ba051cdb550d0c3 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 12 Jun 2008 16:56:20 +0100 Subject: [GDB] Add watch and rwatch hardware watchpoints --- src/core/gdbstub.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/gdbstub.c b/src/core/gdbstub.c index c331b85b..8e338775 100644 --- a/src/core/gdbstub.c +++ b/src/core/gdbstub.c @@ -249,6 +249,22 @@ static void gdbstub_continue ( struct gdbstub *stub, int single_step ) { /* Reply will be sent when we hit the next breakpoint or interrupt */ } +static void gdbstub_breakpoint ( struct gdbstub *stub ) { + unsigned long args [ 3 ]; + int enable = stub->payload [ 0 ] == 'Z' ? 1 : 0; + if ( !gdbstub_get_packet_args ( stub, args, sizeof args / sizeof args [ 0 ], NULL ) ) { + gdbstub_send_errno ( stub, POSIX_EINVAL ); + return; + } + if ( gdbmach_set_breakpoint ( args [ 0 ], args [ 1 ], args [ 2 ], enable ) ) { + gdbstub_send_ok ( stub ); + } else { + /* Not supported */ + stub->len = 0; + gdbstub_tx_packet ( stub ); + } +} + static void gdbstub_rx_packet ( struct gdbstub *stub ) { switch ( stub->payload [ 0 ] ) { case '?': @@ -275,6 +291,10 @@ static void gdbstub_rx_packet ( struct gdbstub *stub ) { gdbstub_send_ok ( stub ); } break; + case 'Z': /* Insert breakpoint */ + case 'z': /* Remove breakpoint */ + gdbstub_breakpoint ( stub ); + break; default: stub->len = 0; gdbstub_tx_packet ( stub ); @@ -341,7 +361,7 @@ static struct gdbstub stub = { .parse = gdbstub_state_new }; -__cdecl void gdbstub_handler ( int signo, gdbreg_t *regs ) { +void gdbstub_handler ( int signo, gdbreg_t *regs ) { char packet [ SIZEOF_PAYLOAD + 4 ]; size_t len, i; -- cgit v1.2.3-55-g7522