Date: Mon, 4 Jan 2021 21:11:17 GMT From: Mitchell Horne <mhorne@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1c002413c3d5 - stable/12 - gdb(4): allow bulk write of registers Message-ID: <202101042111.104LBH6S011012@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 commit 1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2020-12-23 18:37:05 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2021-01-04 21:00:42 +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 Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit 3f3cc995a35a3e9136204a98af0af5808c11047f) --- 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 4c16e06daecf..c5a77430ca5f 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -199,9 +199,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101042111.104LBH6S011012>