public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31194] Stepping on "int3" instruction fails assertion.
Date: Sun, 31 Dec 2023 20:45:03 +0000	[thread overview]
Message-ID: <bug-31194-4717-Fu5lmqmCVh@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31194-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31194

--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
This works but I have no idea if it is correct.

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1d863896c40..c9c16001f82 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7115,6 +7115,7 @@ handle_signal_stop (struct execution_control_state *ecs)

   /* Maybe this was a trap for a software breakpoint that has since
      been removed.  */
+  bool program_bp = false;
   if (random_signal && target_stopped_by_sw_breakpoint ())
     {
       if (gdbarch_program_breakpoint_here_p (gdbarch,
@@ -7123,6 +7124,7 @@ handle_signal_stop (struct execution_control_state *ecs)
          struct regcache *regcache;
          int decr_pc;

+         program_bp = true;
          /* Re-adjust PC to what the program would see if GDB was not
             debugging it.  */
          regcache = get_thread_regcache (ecs->event_thread);
@@ -7161,7 +7163,8 @@ handle_signal_stop (struct execution_control_state *ecs)
   /* If not, perhaps stepping/nexting can.  */
   if (random_signal)
     random_signal = !(ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
-                     && currently_stepping (ecs->event_thread));
+                     && currently_stepping (ecs->event_thread)
+                     && !program_bp);

   /* Perhaps the thread hit a single-step breakpoint of _another_
      thread.  Single-step breakpoints are transparent to the

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-12-31 20:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27 22:54 [Bug gdb/31194] New: " peter0x44 at disroot dot org
2023-12-27 22:58 ` [Bug gdb/31194] " peter0x44 at disroot dot org
2023-12-27 23:04 ` peter0x44 at disroot dot org
2023-12-28  9:51 ` ssbssa at sourceware dot org
2023-12-28 11:25 ` vries at gcc dot gnu.org
2023-12-28 16:42 ` tromey at sourceware dot org
2023-12-29  5:57 ` vries at gcc dot gnu.org
2023-12-29  6:25 ` vries at gcc dot gnu.org
2023-12-29 18:25 ` tromey at sourceware dot org
2023-12-30 17:30 ` tromey at sourceware dot org
2023-12-31  1:46 ` peter0x44 at disroot dot org
2023-12-31  5:15 ` vries at gcc dot gnu.org
2023-12-31 20:02 ` tromey at sourceware dot org
2023-12-31 20:45 ` tromey at sourceware dot org [this message]
2024-01-07 22:03 ` peter0x44 at disroot dot org
2024-01-10 18:43 ` tromey at sourceware dot org
2024-02-08 19:10 ` tromey at sourceware dot org

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=bug-31194-4717-Fu5lmqmCVh@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).