git: f236a9c8c437 - stable/13 - arm64: Return all registers to gdb when able

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

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

commit f236a9c8c437abaab9fceb6feecf56607801d48e
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:34:28 +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 0673f591ef98..14af8b256e5d 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) {