All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Fix oops during single-step debugging
@ 2026-07-22  2:44 haoran.jiang
  0 siblings, 0 replies; only message in thread
From: haoran.jiang @ 2026-07-22  2:44 UTC (permalink / raw)
  To: chenhuacai
  Cc: kernel, loongarch, linux-kernel, yangtiezhu, pjw, palmer,
	Haoran Jiang

From: Haoran Jiang <jianghaoran@kylinos.cn>

When entering KDB via a breakpoint and then performing
single-step debugging,an oops is triggered.During
single-step debugging, kdb_local() expects the reason
to be KDB_REASON_SSTEP, but it is actually KDB_REASON_OOPS.
In kdb_stub(), when determining the reason, the ex_vector for
single-step should be 0, as already implemented on other
architectures such as arm64 and riscv.

Before the patch:
[112]kdb> ss

Entering kdb (current=0x900020009f520000, pid 10661) on
processor 112 Oops: (null)
due to oops @ 0x90000000005b57a4

Signed-off-by: Haoran Jiang <jianghaoran@kylinos.cn>
---
 arch/loongarch/kernel/kgdb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/kgdb.c b/arch/loongarch/kernel/kgdb.c
index 17664a6043b1..ed39f5cee9da 100644
--- a/arch/loongarch/kernel/kgdb.c
+++ b/arch/loongarch/kernel/kgdb.c
@@ -252,7 +252,8 @@ static int kgdb_loongarch_notify(struct notifier_block *self, unsigned long cmd,
 	if (atomic_read(&kgdb_active) != -1)
 		kgdb_nmicallback(smp_processor_id(), regs);
 
-	if (kgdb_handle_exception(args->trapnr, args->signr, cmd, regs))
+	if (kgdb_handle_exception((regs->csr_era == stepped_address ? 0 : args->trapnr),
+				args->signr, cmd, regs))
 		return NOTIFY_DONE;
 
 	if (atomic_read(&kgdb_setting_breakpoint))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-22  2:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22  2:44 [PATCH] LoongArch: Fix oops during single-step debugging haoran.jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.