summaryrefslogtreecommitdiff
path: root/sys/arch/arm64
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-04-18 04:45:21 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-04-18 04:45:21 +0000
commit5a605a79f4c28e5941a2d7ddae133f41be01943b (patch)
tree29dae8806a28879901fbcd50c1f3535ed6a8f24d /sys/arch/arm64
parent65e97594bd9ffe2fd77966373c16eb0015a4f2ae (diff)
Sync existing stacktrace_save() implementations
Upgrade stacktrace_save() to stacktrace_save_at() on architectures where the latter is missing. Define stacktrace_save() as an inline function in header <sys/stacktrace.h> to reduce duplication of code. OK mpi@
Diffstat (limited to 'sys/arch/arm64')
-rw-r--r--sys/arch/arm64/arm64/db_trace.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/arch/arm64/arm64/db_trace.c b/sys/arch/arm64/arm64/db_trace.c
index 8ea1b463e56..a23e4f11d9b 100644
--- a/sys/arch/arm64/arm64/db_trace.c
+++ b/sys/arch/arm64/arm64/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.10 2020/03/29 15:14:28 visa Exp $ */
+/* $OpenBSD: db_trace.c,v 1.11 2020/04/18 04:45:20 visa Exp $ */
/* $NetBSD: db_trace.c,v 1.8 2003/01/17 22:28:48 thorpej Exp $ */
/*
@@ -150,7 +150,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
}
void
-stacktrace_save(struct stacktrace *st)
+stacktrace_save_at(struct stacktrace *st, unsigned int skip)
{
struct callframe *frame, *lastframe, *limit;
struct proc *p = curproc;
@@ -166,7 +166,10 @@ stacktrace_save(struct stacktrace *st)
sizeof(struct trapframe) - 0x10);
while (st->st_count < STACKTRACE_MAX) {
- st->st_pc[st->st_count++] = frame->f_lr;
+ if (skip == 0)
+ st->st_pc[st->st_count++] = frame->f_lr;
+ else
+ skip--;
lastframe = frame;
frame = frame->f_frame;