int s; // current gdb connection
avr_gdb_watchpoints_t breakpoints;
+ avr_gdb_watchpoints_t watchpoints;
} avr_gdb_t;
gdb_send_reply(g, "OK");
break;
- // TODO
case 2: // write watchpoint
case 3: // read watchpoint
case 4: // access watchpoint
+ /* Mask out the offset applied to SRAM addresses. */
+ addr &= ~0x800000;
+ if (addr > avr->ramend ||
+ gdb_change_breakpoint(&g->watchpoints, set, 1 << kind, addr, len) == -1) {
+ gdb_send_reply(g, "E01");
+ break;
+ }
+
+ gdb_send_reply(g, "OK");
+ break;
default:
gdb_send_reply(g, "");
- }
+ break;
+ }
} break;
default:
gdb_send_reply(g, "");
printf("%s connection closed\n", __FUNCTION__);
close(g->s);
gdb_watch_clear(&g->breakpoints);
+ gdb_watch_clear(&g->watchpoints);
g->avr->state = cpu_Running; // resume
g->s = -1;
return 1;