Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Use hardware single step when available
@ 2026-09-16  0:28 Anton Blanchard
  2026-09-16 15:04 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2026-09-16  0:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Anton Blanchard

If the target supports hardware single-stepping use it instead of
inserting software breakpoints. We continue to use software breakpoints
for stepping over LR/SC atomic sequences.
---
 gdb/riscv-tdep.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 100a44cddf3..0413d7b1a35 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -4707,6 +4707,11 @@ riscv_software_single_step (struct regcache *regcache)
   if (!next_pcs.empty ())
     return next_pcs;
 
+  /* If the target supports hardware single-stepping, software
+     single-stepping is unnecessary.  */
+  if (target_can_do_single_step ())
+    return {};
+
   next_pc = riscv_next_pc (regcache, cur_pc);
 
   return {next_pc};
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] RISC-V: Use hardware single step when available
  2026-09-16  0:28 [PATCH] RISC-V: Use hardware single step when available Anton Blanchard
@ 2026-09-16 15:04 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2026-09-16 15:04 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: gdb-patches

>>>>> "Anton" == Anton Blanchard <antonb@tenstorrent.com> writes:

Anton> If the target supports hardware single-stepping use it instead of
Anton> inserting software breakpoints. We continue to use software breakpoints
Anton> for stepping over LR/SC atomic sequences.

I'm definitely not the person to review RISC-V bugs.

That said, I'm curious about two things.

First, if the target advertises that it can single-step, should that
include stepping over atomic sequences?  IOW could this also be deferred
to, say, gdbserver to handle properly?

Second, I wonder why target_can_do_single_step isn't called at some
higher level.

Anyway I see that arm-linux-tdep.c -- but not arm-tdep.c,
mysteriously -- does what you've done here.  And I don't have any
objection or anything, just questions.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-16 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  0:28 [PATCH] RISC-V: Use hardware single step when available Anton Blanchard
2026-09-16 15:04 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox