return i;
}
}
-
return -1;
}
for (int i = 0; i < w->len; i++) {
if (w->points[i].addr > addr) {
return -1;
- } else if (w->points[i].addr <= addr && addr < w->points[i].addr + w->points[i].size) {
+ } else if (w->points[i].addr <= addr &&
+ addr < w->points[i].addr + w->points[i].size) {
return i;
}
}
-
return -1;
}
uint32_t addr,
uint32_t size )
{
+ if (kind == AVR_GDB_WATCH_ACCESS)
+ kind |= AVR_GDB_WATCH_WRITE | AVR_GDB_WATCH_READ;
+
/* If the watchpoint exists, update it. */
int i = gdb_watch_find(w, addr);
if (i != -1) {
g->ior_count = count;
}
ip += n;
+ DBG(
+ } else if (strncmp(ip, "say ", 4) == 0) {
+ // Put a message in the debug output.
+ printf("Say: %s\n", ip + 4);
+ ip += strlen(ip);
+ )
} else {
return 5;
}
break;
}
} break;
- case 'K': // kill
- case 'D': { // detach
+ case 'k': // kill
avr->state = cpu_Done;
gdb_send_reply(g, "OK");
- } break;
+ break;
+ case 'D': // detach
+ avr->state = cpu_Running;
+ gdb_send_reply(g, "OK");
+ close(g->s);
+ g->s = -1;
+ break;
case 'v':
handle_v(avr, g, cmd, length);
break;
}
int kind = g->watchpoints.points[i].kind;
+ DBG(printf("Addr %04x found watchpoint %d size %d type %x wanted %x\n",
+ addr, i, g->watchpoints.points[i].size, kind, type);)
if (kind & type) {
/* Send gdb reply (see GDB user manual appendix E.3). */
char cmd[78];
AVR_GDB_WATCH_WRITE = 1 << 2,
AVR_GDB_WATCH_READ = 1 << 3,
- AVR_GDB_WATCH_ACCESS = AVR_GDB_WATCH_WRITE | AVR_GDB_WATCH_READ,
+ AVR_GDB_WATCH_ACCESS = 1 << 4
};
int avr_gdb_init(avr_t * avr);