aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-06-25 22:13:53 +0000
committerPedro Alves <palves@redhat.com>2009-06-25 22:13:53 +0000
commitd993e290c9829e84cb4f342d043db2c1147bb88a (patch)
tree13600a03aa96bdb020c97124ac605e3af7dee2ff /gdb/gdbserver/server.c
parentf3a5f1de542b6920ab36db2b181006b6ff82ca2a (diff)
downloadgdb-d993e290c9829e84cb4f342d043db2c1147bb88a.zip
gdb-d993e290c9829e84cb4f342d043db2c1147bb88a.tar.gz
gdb-d993e290c9829e84cb4f342d043db2c1147bb88a.tar.bz2
* server.c (process_serial_event): Re-return unsupported, not
error, if the type isn't recognized. Re-allow supporting only insert or remove packets. Also call require_running for breakpoints. Add missing break statement to default case. Tidy. * target.h (struct target_ops): Rename insert_watchpoint to insert_point, and remove_watchpoint to remove_point. * linux-low.h (struct linux_target_ops): Likewise. * linux-low.c (linux_insert_watchpoint): Rename to ... (linux_insert_point): ... this. Adjust. (linux_remove_watchpoint): Rename to ... (linux_remove_point): ... this. Adjust. (linux_target_ops): Adjust. * linux-crisv32-low.c (cris_insert_watchpoint): Rename to ... (cris_insert_point): ... this. (cris_remove_watchpoint): Rename to ... (cris_remove_point): ... this. (the_low_target): Adjust.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 01928c9..76c2e0e 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2383,38 +2383,26 @@ process_serial_event (void)
int len = strtol (lenptr + 1, &dataptr, 16);
char type = own_buf[1];
int res;
- const int insert_ = ch == 'Z';
+ 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
- || the_target->remove_watchpoint == NULL)
- res = 1; /* Not supported. */
- else
- 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. */
- }
+ /* Default to unrecognized/unsupported. */
+ res = 1;
+ switch (type)
+ {
+ case '0': /* software-breakpoint */
+ case '1': /* hardware-breakpoint */
+ case '2': /* write watchpoint */
+ case '3': /* read watchpoint */
+ case '4': /* access watchpoint */
+ require_running (own_buf);
+ if (insert && the_target->insert_point != NULL)
+ res = (*the_target->insert_point) (type, addr, len);
+ else if (!insert && the_target->remove_point != NULL)
+ res = (*the_target->remove_point) (type, addr, len);
+ break;
+ default:
+ break;
+ }
if (res == 0)
write_ok (own_buf);