oops, my previous commit is bad. revert previous.

<frame-address> is a frame pointer, not a trapframe, and it worked correctly. (e.g., trace $x29)
This commit is contained in:
ryo 2022-09-22 21:48:18 +00:00
parent 7bdf691e15
commit 7111059e75
1 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_trace.c,v 1.22 2022/09/22 21:00:46 ryo Exp $ */
/* $NetBSD: db_trace.c,v 1.23 2022/09/22 21:48:18 ryo Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.22 2022/09/22 21:00:46 ryo Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.23 2022/09/22 21:48:18 ryo Exp $");
#include <sys/param.h>
#include <sys/bitops.h>
@ -497,6 +497,15 @@ db_sp_trace(struct trapframe *tf, db_addr_t fp, db_expr_t count, int flags,
db_addr_t pc, sp, lr0;
bool allow_leaf_function = false;
if (tf == NULL) {
/*
* In the case of "trace/s <frame-address>",
* the specified frame pointer address is considered
* a trapframe (or a switchframe) address.
*/
tf = (struct trapframe *)fp;
}
pr_frame(tf, pr);
db_read_bytes((db_addr_t)tf, sizeof(tf_buf), (char *)&tf_buf);
@ -801,15 +810,6 @@ db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count,
if (count > MAXBACKTRACE)
count = MAXBACKTRACE;
if (tf == NULL) {
/*
* In the case of "trace <frame-address>",
* the specified frame pointer address is considered
* a trapframe (or a switchframe) address.
*/
tf = (struct trapframe *)fp;
}
if (trace_sp) {
/* trace $lr pushed to sp */
db_sp_trace(tf, fp, count, flags, pr);