summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2019-11-01 18:03:51 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2019-11-01 18:03:51 +0000
commit1ba480fa0b8f1268e5c2c616e0cb5d249b30d1b2 (patch)
treefd66a89b91766b13cc865b71992917f1dac5462d
parente24fcba90ecba2ea118c82e44b76aa7fcd23b08a (diff)
Fix an off-by-one in db_save_stack_trace().
Save the PC after checking if it belongs to the kernel.
-rw-r--r--sys/arch/sparc64/sparc64/db_trace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/db_trace.c b/sys/arch/sparc64/sparc64/db_trace.c
index fdbf0043a54..bf14be083b4 100644
--- a/sys/arch/sparc64/sparc64/db_trace.c
+++ b/sys/arch/sparc64/sparc64/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.16 2019/11/01 17:50:53 mpi Exp $ */
+/* $OpenBSD: db_trace.c,v 1.17 2019/11/01 18:03:50 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.23 2001/07/10 06:06:16 eeh Exp $ */
/*
@@ -171,7 +171,6 @@ db_save_stack_trace(struct db_stack_trace *st)
f64 = (struct frame64 *)(frame + BIAS);
pc = (db_addr_t)KLOAD(f64->fr_pc);
- st->st_pc[st->st_count++] = pc;
frame = KLOAD(f64->fr_fp);
if (pc < KERNBASE || pc >= KERNEND)
@@ -180,6 +179,8 @@ db_save_stack_trace(struct db_stack_trace *st)
break;
if ((frame & 1) == 0)
break;
+
+ st->st_pc[st->st_count++] = pc;
}
}