From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:11:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C84814CD1BF; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8pFx5FkJz4WRH; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A71AD20922; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LBH1i011013; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LBH6S011012; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:11:17 GMT Message-Id: <202101042111.104LBH6S011012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 1c002413c3d5 - stable/12 - gdb(4): allow bulk write of registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:11:17 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 commit 1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 Author: Mitchell Horne AuthorDate: 2020-12-23 18:37:05 +0000 Commit: Mitchell Horne 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;