Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64/aarch64 aarch64: Fix stack traces from jump...
details: https://anonhg.NetBSD.org/src/rev/c099e02d905c
branches: trunk
changeset: 1026511:c099e02d905c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Nov 27 14:11:04 2021 +0000
description:
aarch64: Fix stack traces from jump-to-null.
diffstat:
sys/arch/aarch64/aarch64/db_trace.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r 22dbddc06c4e -r c099e02d905c sys/arch/aarch64/aarch64/db_trace.c
--- a/sys/arch/aarch64/aarch64/db_trace.c Sat Nov 27 10:00:01 2021 +0000
+++ b/sys/arch/aarch64/aarch64/db_trace.c Sat Nov 27 14:11:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.13 2020/12/11 18:03:33 skrll Exp $ */
+/* $NetBSD: db_trace.c,v 1.14 2021/11/27 14:11:04 riastradh Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.13 2020/12/11 18:03:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.14 2021/11/27 14:11:04 riastradh Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -302,8 +302,21 @@
lastfp = (uint64_t)tf;
lastlr = lr;
lr = fp = 0;
- db_read_bytes((db_addr_t)&tf->tf_pc, sizeof(lr), (char *)&lr);
- db_read_bytes((db_addr_t)&tf->tf_reg[29], sizeof(fp), (char *)&fp);
+ db_read_bytes((db_addr_t)&tf->tf_pc, sizeof(lr),
+ (char *)&lr);
+ if (lr == 0) {
+ /*
+ * The exception may have been from a
+ * jump to null, so the null pc we
+ * would return to is useless. Try
+ * x[30] instead -- that will be the
+ * return address for the jump.
+ */
+ db_read_bytes((db_addr_t)&tf->tf_reg[30],
+ sizeof(lr), (char *)&lr);
+ }
+ db_read_bytes((db_addr_t)&tf->tf_reg[29], sizeof(fp),
+ (char *)&fp);
lr = aarch64_strip_pac(lr);
/*
Home |
Main Index |
Thread Index |
Old Index