svn commit: r324680 - head/sys/gdb
Ryan Libby
rlibby at FreeBSD.org
Tue Oct 17 01:12:19 UTC 2017
Author: rlibby
Date: Tue Oct 17 01:12:17 2017
New Revision: 324680
URL: https://svnweb.freebsd.org/changeset/base/324680
Log:
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 at dons.net.au>
Reviewed by: cem, jhb
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12684
Modified:
head/sys/gdb/gdb_main.c
Modified: head/sys/gdb/gdb_main.c
==============================================================================
--- head/sys/gdb/gdb_main.c Tue Oct 17 00:25:44 2017 (r324679)
+++ head/sys/gdb/gdb_main.c Tue Oct 17 01:12:17 2017 (r324680)
@@ -94,6 +94,33 @@ gdb_init(void)
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
gdb_trap(int type, int code)
{
@@ -257,27 +284,7 @@ gdb_trap(int type, int code)
gdb_tx_end();
}
} else if (gdb_rx_equal("Search:memory:")) {
- 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);
- 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;
+ gdb_do_mem_search();
} else if (!gdb_cpu_query())
gdb_tx_empty();
break;
More information about the svn-src-all
mailing list