From: Jinyang He <hejinyang@loongson.cn>
To: Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
Qing Zhang <zhangqing@loongson.cn>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 3/6] LoongArch: Adjust PC value when unwind next frame in prologue unwinder
Date: Thu, 15 Dec 2022 12:01:38 +0800 [thread overview]
Message-ID: <20221215040141.18610-4-hejinyang@loongson.cn> (raw)
In-Reply-To: <20221215040141.18610-1-hejinyang@loongson.cn>
When state->first is not set, the PC is a return address in the
previous frame. We need to adjust it value in case overflow to the
next symbol.
Signed-off-by: Jinyang He <hejinyang@loongson.cn>
---
arch/loongarch/kernel/unwind_prologue.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
index 35cab7f77c6b..d464c533c64f 100644
--- a/arch/loongarch/kernel/unwind_prologue.c
+++ b/arch/loongarch/kernel/unwind_prologue.c
@@ -48,7 +48,7 @@ static bool unwind_by_prologue(struct unwind_state *state)
{
long frame_ra = -1;
unsigned long frame_size = 0;
- unsigned long size, offset, pc = state->pc;
+ unsigned long size, offset, pc;
struct pt_regs *regs;
struct stack_info *info = &state->stack_info;
union loongarch_instruction *ip, *ip_end;
@@ -70,6 +70,10 @@ static bool unwind_by_prologue(struct unwind_state *state)
return true;
}
+ /* When first is not set, the PC is a return address in the previous frame.
+ * We need to adjust it value in case overflow to the next symbol.
+ */
+ pc = state->pc - (state->first ? 0 : LOONGARCH_INSN_SIZE);
if (!kallsyms_lookup_size_offset(pc, &size, &offset))
return false;
--
2.34.3
next prev parent reply other threads:[~2022-12-15 4:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 4:01 [PATCH 0/6] LoongArch: Some fix and new features for unwinders Jinyang He
2022-12-15 4:01 ` [PATCH 1/6] LoongArch: Get frame info in unwind_start when regs is not supported Jinyang He
2022-12-15 5:24 ` Qing Zhang
2022-12-15 5:55 ` Jinyang He
2022-12-15 4:01 ` [PATCH 2/6] LoongArch: Use correct sp value to get graph addr in unwinder guess Jinyang He
2022-12-15 4:01 ` Jinyang He [this message]
2022-12-15 4:01 ` [PATCH 4/6] LoongArch: Strip guess_unwinder out from prologue_unwinder Jinyang He
2022-12-15 9:15 ` Qing Zhang
2022-12-16 1:40 ` Jinyang He
2022-12-16 2:14 ` Qing Zhang
2022-12-17 1:47 ` Jinyang He
2022-12-17 2:48 ` Qing Zhang
2022-12-19 3:28 ` Qing Zhang
2022-12-15 4:01 ` [PATCH 5/6] LoongArch: Add raw_show_trace to enable guess unwinder default Jinyang He
2022-12-15 6:15 ` Huacai Chen
2022-12-15 6:48 ` Jinyang He
2022-12-15 4:01 ` [PATCH 6/6] LoongArch: Add generic ex-handler unwind in prologue unwinder Jinyang He
2022-12-15 12:04 ` Qing Zhang
2022-12-16 1:44 ` Jinyang He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221215040141.18610-4-hejinyang@loongson.cn \
--to=hejinyang@loongson.cn \
--cc=chenhuacai@kernel.org \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=zhangqing@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®