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)
|
static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
|
||||||
{
|
{
|
||||||
char *parts[2];
|
char *parts[2];
|
||||||
int type;
|
|
||||||
address_t addr;
|
address_t addr;
|
||||||
|
device_bptype_t type;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Break up the arguments */
|
/* Break up the arguments */
|
||||||
|
@ -324,8 +324,16 @@ static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only support breakpoints */
|
/* We only support breakpoints */
|
||||||
type = atoi(parts[0]);
|
switch (atoi(parts[0])) {
|
||||||
if (type < 0 || type > 1) {
|
case 1:
|
||||||
|
type = DEVICE_BPTYPE_BREAK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
type = DEVICE_BPTYPE_WATCH;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
printc_err("gdb: unsupported breakpoint type: %s\n",
|
printc_err("gdb: unsupported breakpoint type: %s\n",
|
||||||
parts[0]);
|
parts[0]);
|
||||||
return gdb_send(data, "");
|
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);
|
addr = strtoul(parts[1], NULL, 16);
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (device_setbrk(device_default, -1, 1, addr,
|
if (device_setbrk(device_default, -1, 1, addr, type) < 0) {
|
||||||
DEVICE_BPTYPE_BREAK) < 0) {
|
|
||||||
printc_err("gdb: can't add breakpoint at "
|
printc_err("gdb: can't add breakpoint at "
|
||||||
"0x%04x\n", addr);
|
"0x%04x\n", addr);
|
||||||
return gdb_send(data, "E00");
|
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);
|
printc("Breakpoint set at 0x%04x\n", addr);
|
||||||
} else {
|
} else {
|
||||||
device_setbrk(device_default, -1, 0, addr,
|
device_setbrk(device_default, -1, 0, addr, type);
|
||||||
DEVICE_BPTYPE_BREAK);
|
|
||||||
printc("Breakpoint cleared at 0x%04x\n", addr);
|
printc("Breakpoint cleared at 0x%04x\n", addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue