Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm Fix crash(8) backtrace support.
details: https://anonhg.NetBSD.org/src/rev/65038c07d8d1
branches: trunk
changeset: 335803:65038c07d8d1
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Jan 24 15:44:32 2015 +0000
description:
Fix crash(8) backtrace support.
diffstat:
sys/arch/arm/arm/db_trace.c | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diffs (87 lines):
diff -r 6c920899f905 -r 65038c07d8d1 sys/arch/arm/arm/db_trace.c
--- a/sys/arch/arm/arm/db_trace.c Sat Jan 24 15:36:51 2015 +0000
+++ b/sys/arch/arm/arm/db_trace.c Sat Jan 24 15:44:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.30 2014/03/29 15:48:01 skrll Exp $ */
+/* $NetBSD: db_trace.c,v 1.31 2015/01/24 15:44:32 skrll Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -31,7 +31,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.30 2014/03/29 15:48:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.31 2015/01/24 15:44:32 skrll Exp $");
#include <sys/proc.h>
#include <arm/armreg.h>
@@ -155,9 +155,19 @@
} else
frame = (uint32_t *)(addr);
}
- lastframe = NULL;
scp_offset = -(get_pc_str_offset() >> 2);
+ if (frame == NULL)
+ return;
+
+ lastframe = frame;
+#ifndef _KERNEL
+ uint32_t frameb[4];
+ db_read_bytes((db_addr_t)(frame - 3), sizeof(frameb),
+ (char *)frameb);
+ frame = frameb + 3;
+#endif
+
/*
* In theory, the SCP isn't guaranteed to be in the function
* that generated the stack frame. We hope for the best.
@@ -169,7 +179,7 @@
#endif
pc = scp;
- while (count-- && frame != NULL) {
+ while (count--) {
uint32_t savecode;
int r;
uint32_t *rp;
@@ -180,14 +190,8 @@
#else
scp = frame[FR_SCP];
#endif
- lastframe = frame;
- (*pr)("%p: ", frame);
-#ifndef _KERNEL
- uint32_t frameb[4];
- db_read_bytes((db_addr_t)(frame - 3), sizeof(frameb),
- (char *)frameb);
- frame = frameb + 3;
-#endif
+ (*pr)("%p: ", lastframe);
+
db_printsym(pc, DB_STGY_PROC, pr);
if (trace_full) {
(*pr)("\n\t");
@@ -244,6 +248,9 @@
frame = (uint32_t *)(frame[FR_RFP]);
+ if (frame == NULL)
+ break;
+
if (INKERNEL((int)frame)) {
/* staying in kernel */
if (frame <= lastframe) {
@@ -262,5 +269,11 @@
break;
}
}
+ lastframe = frame;
+#ifndef _KERNEL
+ db_read_bytes((db_addr_t)(frame - 3), sizeof(frameb),
+ (char *)frameb);
+ frame = frameb + 3;
+#endif
}
}
Home |
Main Index |
Thread Index |
Old Index