git: 1ac1e83f189f - stable/14 - arm64: Return all registers to gdb when able

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 15 Jul 2024 12:38:01 UTC
The branch stable/14 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=1ac1e83f189fae2e6bd346ae1abd877ea584192e

commit 1ac1e83f189fae2e6bd346ae1abd877ea584192e
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-03-14 17:31:39 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-07-15 12:22:50 +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
    
    (cherry picked from commit 0a5f7918fc0e274a904b8fdd7c167bea7cdaf0f4)
---
 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) {