diff options
author | Aleksandar Ristovski <aristovski@qnx.com> | 2009-06-23 15:12:44 +0000 |
---|---|---|
committer | Aleksandar Ristovski <aristovski@qnx.com> | 2009-06-23 15:12:44 +0000 |
commit | c631402292d43f01daa982c42c82f96e39659d99 (patch) | |
tree | b0406646b06b99ee86ba3cdf7f8ee697b9f0cc30 /gdb/gdbserver/server.c | |
parent | 0639a6f66272d7fdc956bd64e2cbf6acfd10a03d (diff) | |
download | gdb-c631402292d43f01daa982c42c82f96e39659d99.zip gdb-c631402292d43f01daa982c42c82f96e39659d99.tar.gz gdb-c631402292d43f01daa982c42c82f96e39659d99.tar.bz2 |
* server.c (process_serial_event): Add support for Z0 and Z1 packet.
* target.h (target_ops): Comment for *_watchpoint to make it clear
the functions can get types '0' and '1'.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r-- | gdb/gdbserver/server.c | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index a9bf4a8..566e47d 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2371,66 +2371,56 @@ process_serial_event (void) signal = 0; myresume (own_buf, 1, signal); break; - case 'Z': + case 'Z': /* insert_ ... */ + /* Fallthrough. */ + case 'z': /* remove_ ... */ { char *lenptr; char *dataptr; CORE_ADDR addr = strtoul (&own_buf[3], &lenptr, 16); int len = strtol (lenptr + 1, &dataptr, 16); char type = own_buf[1]; + int res; + const int insert_ = ch == 'Z'; + + /* Type: '0' - software-breakpoint + '1' - hardware-breakpoint + '2' - write watchpoint + '3' - read watchpoint + '4' - access watchpoint */ if (the_target->insert_watchpoint == NULL - || (type < '2' || type > '4')) - { - /* No watchpoint support or not a watchpoint command; - unrecognized either way. */ - own_buf[0] = '\0'; - } + || the_target->remove_watchpoint == NULL) + res = 1; /* Not supported. */ else - { - int res; - - require_running (own_buf); - res = (*the_target->insert_watchpoint) (type, addr, len); - if (res == 0) - write_ok (own_buf); - else if (res == 1) - /* Unsupported. */ - own_buf[0] = '\0'; - else - write_enn (own_buf); - } - break; - } - case 'z': - { - char *lenptr; - char *dataptr; - CORE_ADDR addr = strtoul (&own_buf[3], &lenptr, 16); - int len = strtol (lenptr + 1, &dataptr, 16); - char type = own_buf[1]; + switch (type) + { + case '2': + /* Fallthrough. */ + case '3': + /* Fallthrough. */ + case '4': + require_running (own_buf); + /* Fallthrough. */ + case '0': + /* Fallthrough. */ + case '1': + res = insert_ ? (*the_target->insert_watchpoint) (type, addr, + len) + : (*the_target->remove_watchpoint) (type, addr, + len); + break; + default: + res = -1; /* Unrecognized type. */ + } - if (the_target->remove_watchpoint == NULL - || (type < '2' || type > '4')) - { - /* No watchpoint support or not a watchpoint command; - unrecognized either way. */ - own_buf[0] = '\0'; - } + if (res == 0) + write_ok (own_buf); + else if (res == 1) + /* Unsupported. */ + own_buf[0] = '\0'; else - { - int res; - - require_running (own_buf); - res = (*the_target->remove_watchpoint) (type, addr, len); - if (res == 0) - write_ok (own_buf); - else if (res == 1) - /* Unsupported. */ - own_buf[0] = '\0'; - else - write_enn (own_buf); - } + write_enn (own_buf); break; } case 'k': |