git: 7b7138454fd3 - stable/12 - gdb(4): handle single register read packets

Mitchell Horne mhorne at FreeBSD.org
Mon Jan 4 21:11:18 UTC 2021


The branch stable/12 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b7138454fd3b629823728a365ebd34b6bd37212

commit 7b7138454fd3b629823728a365ebd34b6bd37212
Author:     Mitchell Horne <mhorne at FreeBSD.org>
AuthorDate: 2020-12-23 18:36:08 +0000
Commit:     Mitchell Horne <mhorne at FreeBSD.org>
CommitDate: 2021-01-04 21:00:12 +0000

    gdb(4): handle single register read packets
    
    We support bulk reads of the register set, but not reading specific
    registers via the 'p' packet. This is useful at least for the 'call'
    command in gdb.
    
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    
    (cherry picked from commit fd29833d9a7d8355ce21743ed8c706b72ba03363)
---
 sys/gdb/gdb_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c
index 206fee4f7566..4c16e06daecf 100644
--- a/sys/gdb/gdb_main.c
+++ b/sys/gdb/gdb_main.c
@@ -252,6 +252,17 @@ gdb_trap(int type, int code)
 				gdb_tx_ok();
 			break;
 		}
+		case 'p': {     /* Read register. */
+			uintmax_t reg;
+			if (gdb_rx_varhex(&reg)) {
+				gdb_tx_err(EINVAL);
+				break;
+			}
+			gdb_tx_begin(0);
+			gdb_tx_reg(reg);
+			gdb_tx_end();
+			break;
+		}
 		case 'P': {	/* Write register. */
 			char *val;
 			uintmax_t reg;


More information about the dev-commits-src-branches mailing list