summaryrefslogtreecommitdiffstats
path: root/src/core/gdbstub.c
diff options
context:
space:
mode:
authorStefan Hajnoczi2008-06-12 17:56:20 +0200
committerMichael Brown2008-06-30 20:19:48 +0200
commit19386ec2c8c9f266425453673ba051cdb550d0c3 (patch)
tree3b159c2ad6bcb40241b82279c98742c9dca6ff65 /src/core/gdbstub.c
parent[GDB] Remote debugging over UDP (diff)
downloadipxe-19386ec2c8c9f266425453673ba051cdb550d0c3.tar.gz
ipxe-19386ec2c8c9f266425453673ba051cdb550d0c3.tar.xz
ipxe-19386ec2c8c9f266425453673ba051cdb550d0c3.zip
[GDB] Add watch and rwatch hardware watchpoints
Diffstat (limited to 'src/core/gdbstub.c')
-rw-r--r--src/core/gdbstub.c22
1 files changed, 21 insertions, 1 deletions
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;