gdb kernel server: fixup Search:memory style
This is a NFC patch to move around the Search:memory implementation so that it doesn't exceed the standard column width and doesn't take so much vertical space in gdb_trap. Submitted by: Daniel O'Connor <darius@dons.net.au> Reviewed by: cem, jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12684
This commit is contained in:
parent
f49c813c1d
commit
8a7a65717a
@ -94,6 +94,33 @@ gdb_init(void)
|
|||||||
return (cur_pri);
|
return (cur_pri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gdb_do_mem_search(void)
|
||||||
|
{
|
||||||
|
size_t patlen;
|
||||||
|
intmax_t addr, size;
|
||||||
|
const unsigned char *found;
|
||||||
|
|
||||||
|
if (gdb_rx_varhex(&addr) || gdb_rx_char() != ';' ||
|
||||||
|
gdb_rx_varhex(&size) || gdb_rx_char() != ';' ||
|
||||||
|
gdb_rx_bindata(gdb_bindata, sizeof(gdb_bindata), &patlen)) {
|
||||||
|
gdb_tx_err(EINVAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gdb_search_mem((char *)(uintptr_t)addr, size, gdb_bindata,
|
||||||
|
patlen, &found)) {
|
||||||
|
if (found == 0ULL)
|
||||||
|
gdb_tx_begin('0');
|
||||||
|
else {
|
||||||
|
gdb_tx_begin('1');
|
||||||
|
gdb_tx_char(',');
|
||||||
|
gdb_tx_hex((intmax_t)(uintptr_t)found, 8);
|
||||||
|
}
|
||||||
|
gdb_tx_end();
|
||||||
|
} else
|
||||||
|
gdb_tx_err(EIO);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gdb_trap(int type, int code)
|
gdb_trap(int type, int code)
|
||||||
{
|
{
|
||||||
@ -257,27 +284,7 @@ gdb_trap(int type, int code)
|
|||||||
gdb_tx_end();
|
gdb_tx_end();
|
||||||
}
|
}
|
||||||
} else if (gdb_rx_equal("Search:memory:")) {
|
} else if (gdb_rx_equal("Search:memory:")) {
|
||||||
size_t patlen;
|
gdb_do_mem_search();
|
||||||
intmax_t addr, size;
|
|
||||||
const unsigned char *found;
|
|
||||||
if (gdb_rx_varhex(&addr) || gdb_rx_char() != ';' ||
|
|
||||||
gdb_rx_varhex(&size) || gdb_rx_char() != ';' ||
|
|
||||||
gdb_rx_bindata(gdb_bindata, sizeof(gdb_bindata), &patlen)) {
|
|
||||||
gdb_tx_err(EINVAL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (gdb_search_mem((char *)(uintptr_t)addr, size, gdb_bindata, patlen, &found)) {
|
|
||||||
if (found == 0ULL)
|
|
||||||
gdb_tx_begin('0');
|
|
||||||
else {
|
|
||||||
gdb_tx_begin('1');
|
|
||||||
gdb_tx_char(',');
|
|
||||||
gdb_tx_hex((intmax_t)(uintptr_t)found, 8);
|
|
||||||
}
|
|
||||||
gdb_tx_end();
|
|
||||||
} else
|
|
||||||
gdb_tx_err(EIO);
|
|
||||||
break;
|
|
||||||
} else if (!gdb_cpu_query())
|
} else if (!gdb_cpu_query())
|
||||||
gdb_tx_empty();
|
gdb_tx_empty();
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user