{
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;
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)))
{
{
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;