Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Anton Blanchard <antonb@tenstorrent.com>
To: gdb-patches@sourceware.org
Cc: Anton Blanchard <antonb@tenstorrent.com>
Subject: [PATCH] RISC-V: Use hardware single step when available
Date: Wed, 16 Sep 2026 00:28:31 +0000	[thread overview]
Message-ID: <20260916002831.1775922-1-antonb@tenstorrent.com> (raw)

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


                 reply	other threads:[~2026-09-16  0:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260916002831.1775922-1-antonb@tenstorrent.com \
    --to=antonb@tenstorrent.com \
    --cc=gdb-patches@sourceware.org \
    /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