mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 12:11:08 +01:00
bhyve: Add support for the 'p' query
This lets gdb query individual registers. It's easy to implement and is used by gdb when attaching to a CHERI target, so let's support it. Sponsored by: Innovate UK Reviewed by: corvink, jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D43664
This commit is contained in:
parent
f1e8d3361b
commit
e6516294f4
@ -1035,6 +1035,29 @@ gdb_read_regs(void)
|
||||
finish_packet();
|
||||
}
|
||||
|
||||
static void
|
||||
gdb_read_one_reg(const uint8_t *data, size_t len)
|
||||
{
|
||||
uint64_t regval;
|
||||
uintmax_t reg;
|
||||
|
||||
reg = parse_integer(data, len);
|
||||
if (reg >= nitems(gdb_regset)) {
|
||||
send_error(EINVAL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vm_get_register(vcpus[cur_vcpu], gdb_regset[reg].id, ®val) ==
|
||||
-1) {
|
||||
send_error(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
start_packet();
|
||||
append_unsigned_native(regval, gdb_regset[reg].size);
|
||||
finish_packet();
|
||||
}
|
||||
|
||||
static void
|
||||
gdb_read_mem(const uint8_t *data, size_t len)
|
||||
{
|
||||
@ -1597,10 +1620,12 @@ handle_command(const uint8_t *data, size_t len)
|
||||
|
||||
/* TODO: Resume any stopped CPUs. */
|
||||
break;
|
||||
case 'g': {
|
||||
case 'g':
|
||||
gdb_read_regs();
|
||||
break;
|
||||
}
|
||||
case 'p':
|
||||
gdb_read_one_reg(data + 1, len - 1);
|
||||
break;
|
||||
case 'H': {
|
||||
int tid;
|
||||
|
||||
@ -1672,7 +1697,6 @@ handle_command(const uint8_t *data, size_t len)
|
||||
case 'v':
|
||||
/* Handle 'vCont' */
|
||||
/* 'vCtrlC' */
|
||||
case 'p': /* TODO */
|
||||
case 'P': /* TODO */
|
||||
case 'Q': /* TODO */
|
||||
case 't': /* TODO */
|
||||
|
Loading…
Reference in New Issue
Block a user