git: 0a5f7918fc0e - main - arm64: Return all registers to gdb when able

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 18 Mar 2024 16:37:57 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a5f7918fc0e274a904b8fdd7c167bea7cdaf0f4

commit 0a5f7918fc0e274a904b8fdd7c167bea7cdaf0f4
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-03-14 17:31:39 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-03-18 16:22:18 +0000

    arm64: Return all registers to gdb when able
    
    When the kdb thread is the current thread we read the registers from
    the trap frame. As this contains all general purpose registers we can
    use it to read these in the gdb stub. This allows us to include the
    non-callee saved registers, e.g. function arguments.
    
    Reviewed by:    imp
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D44360
---
 sys/arm64/arm64/gdb_machdep.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/arm64/arm64/gdb_machdep.c b/sys/arm64/arm64/gdb_machdep.c
index f93d7f83bd9d..dcfc91b33eb7 100644
--- a/sys/arm64/arm64/gdb_machdep.c
+++ b/sys/arm64/arm64/gdb_machdep.c
@@ -55,6 +55,10 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
 		case GDB_REG_SP:   return (&kdb_frame->tf_sp);
 		case GDB_REG_PC:   return (&kdb_frame->tf_elr);
 		case GDB_REG_CSPR: return (&kdb_frame->tf_spsr);
+		default:
+			if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29)
+				return (&kdb_frame->tf_x[regnum - GDB_REG_X0]);
+			break;
 		}
 	}
 	switch (regnum) {