Add watchpoint support to GDB server.
Only read/write watchpoints are supported (set with the "awatch" GDB command).
This commit is contained in:
parent
f1e99c38d3
commit
a2ee047cc0
20
ui/gdb.c
20
ui/gdb.c
|
@ -309,8 +309,8 @@ static int run(struct gdb_data *data, char *buf)
|
|||
static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
|
||||
{
|
||||
char *parts[2];
|
||||
int type;
|
||||
address_t addr;
|
||||
device_bptype_t type;
|
||||
int i;
|
||||
|
||||
/* Break up the arguments */
|
||||
|
@ -324,8 +324,16 @@ static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
|
|||
}
|
||||
|
||||
/* We only support breakpoints */
|
||||
type = atoi(parts[0]);
|
||||
if (type < 0 || type > 1) {
|
||||
switch (atoi(parts[0])) {
|
||||
case 1:
|
||||
type = DEVICE_BPTYPE_BREAK;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
type = DEVICE_BPTYPE_WATCH;
|
||||
break;
|
||||
|
||||
default:
|
||||
printc_err("gdb: unsupported breakpoint type: %s\n",
|
||||
parts[0]);
|
||||
return gdb_send(data, "");
|
||||
|
@ -341,8 +349,7 @@ static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
|
|||
addr = strtoul(parts[1], NULL, 16);
|
||||
|
||||
if (enable) {
|
||||
if (device_setbrk(device_default, -1, 1, addr,
|
||||
DEVICE_BPTYPE_BREAK) < 0) {
|
||||
if (device_setbrk(device_default, -1, 1, addr, type) < 0) {
|
||||
printc_err("gdb: can't add breakpoint at "
|
||||
"0x%04x\n", addr);
|
||||
return gdb_send(data, "E00");
|
||||
|
@ -350,8 +357,7 @@ static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
|
|||
|
||||
printc("Breakpoint set at 0x%04x\n", addr);
|
||||
} else {
|
||||
device_setbrk(device_default, -1, 0, addr,
|
||||
DEVICE_BPTYPE_BREAK);
|
||||
device_setbrk(device_default, -1, 0, addr, type);
|
||||
printc("Breakpoint cleared at 0x%04x\n", addr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue