git: 3f3cc995a35a - gdb(4): allow bulk write of registers
Mitchell Horne
mhorne at FreeBSD.org
Wed Dec 23 18:50:27 UTC 2020
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=3f3cc995a35a3e9136204a98af0af5808c11047f
commit 3f3cc995a35a3e9136204a98af0af5808c11047f
Author: Mitchell Horne <mhorne at FreeBSD.org>
AuthorDate: 2020-12-23 18:37:05 +0000
Commit: Mitchell Horne <mhorne at FreeBSD.org>
CommitDate: 2020-12-23 18:37:05 +0000
gdb(4): allow bulk write of registers
Add support for the remote 'G' packet. This is not widely used by gdb
when 'P' is supported, but is technically required by any remote gdb
stub implementation [1].
[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Overview.html
Reviewed by: cem
MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
NetApp PR: 44
Differential Revision: https://reviews.freebsd.org/D27644
---
sys/gdb/gdb_main.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c
index 588a97c56a40..6e0c9f21f947 100644
--- a/sys/gdb/gdb_main.c
+++ b/sys/gdb/gdb_main.c
@@ -700,9 +700,23 @@ gdb_trap(int type, int code)
gdb_tx_end();
break;
}
- case 'G': /* Write registers. */
- gdb_tx_err(0);
+ case 'G': { /* Write registers. */
+ char *val;
+ bool success;
+ size_t r;
+ for (success = true, r = 0; r < GDB_NREGS; r++) {
+ val = gdb_rxp;
+ if (!gdb_rx_mem(val, gdb_cpu_regsz(r))) {
+ gdb_tx_err(EINVAL);
+ success = false;
+ break;
+ }
+ gdb_cpu_setreg(r, val);
+ }
+ if (success)
+ gdb_tx_ok();
break;
+ }
case 'H': { /* Set thread. */
intmax_t tid;
struct thread *thr;
More information about the dev-commits-src-main
mailing list