summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-01-11 09:22:08 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-01-13 12:00:02 +0100
commit3e33393078105f25ebd591b5b76c7c1501ff41d5 (patch)
tree896053cc0894d74919d953761f3b7ec218fc3c62 /src/server
parent6c75f5249cf721aa8b8c2d774cdeeac6f9770e32 (diff)
downloadopenocd+libswd-3e33393078105f25ebd591b5b76c7c1501ff41d5.tar.gz
openocd+libswd-3e33393078105f25ebd591b5b76c7c1501ff41d5.tar.bz2
openocd+libswd-3e33393078105f25ebd591b5b76c7c1501ff41d5.tar.xz
openocd+libswd-3e33393078105f25ebd591b5b76c7c1501ff41d5.zip
gdbserver: fix typo that broke read/write watchpoint
It looks like a bugfix from normal breakpoints was not copied over. Do not use clever mathematics and assumptions to convert from GDB enum for break/watchpoints to OpenOCD enum. Drop connection upon unknown breakpoint type, this code path was not really considered by the previous code I think. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index f4a99cae..8018e6f9 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -1423,7 +1423,7 @@ int gdb_breakpoint_watchpoint_packet(struct connection *connection, struct targe
{
int type;
enum breakpoint_type bp_type = BKPT_SOFT /* dummy init to avoid warning */;
- enum watchpoint_rw wp_type;
+ enum watchpoint_rw wp_type = WPT_READ /* dummy init to avoid warning */;
uint32_t address;
uint32_t size;
char *separator;
@@ -1443,6 +1443,12 @@ int gdb_breakpoint_watchpoint_packet(struct connection *connection, struct targe
wp_type = WPT_READ;
else if (type == 4) /* access watchpoint */
wp_type = WPT_ACCESS;
+ else
+ {
+ LOG_ERROR("invalid gdb watch/breakpoint type(%d), dropping connection", type);
+ return ERROR_SERVER_REMOTE_CLOSED;
+ }
+
if (gdb_breakpoint_override && ((bp_type == BKPT_SOFT)||(bp_type == BKPT_HARD)))
{
@@ -1493,7 +1499,7 @@ int gdb_breakpoint_watchpoint_packet(struct connection *connection, struct targe
{
if (packet[0] == 'Z')
{
- if ((retval = watchpoint_add(target, address, size, type-2, 0, 0xffffffffu)) != ERROR_OK)
+ if ((retval = watchpoint_add(target, address, size, wp_type, 0, 0xffffffffu)) != ERROR_OK)
{
if ((retval = gdb_error(connection, retval)) != ERROR_OK)
return retval;