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:02:27 +0000	[thread overview]
Message-ID: <bug-31194-4717-BXLUoiIJyt@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 #9 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Peter0x44 from comment #7)
> > I'm not really sure how int3 is supposed to be handled
> Perhaps it would be beneficial to state what my preferences would be.

Yes, thanks.

I dug into the code a bit and, first of all, gdb already does
support this situation.  It's called a "permanent breakpoint"
in the implementation.

There's even a test for this, gdb.arch/i386-bp_permanent.exp.
However, that tests "continue", not stepping.

I think perhaps the issue is that we reach the end of handle_signal_stop
with:

(top-gdb) p random_signal
$30 = 0

and in particular maybe:

  /* If not, perhaps stepping/nexting can.  */
  if (random_signal)
    random_signal = !(ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
                      && currently_stepping (ecs->event_thread));

here the call to currently_stepping returns true.

Maybe this should be checking the PC and setting random_signal if it
is out of range?
Or maybe the earlier code that calls gdbarch_program_breakpoint_here_p
should set some sort of local flag, so that this can check it?

I don't really know infrun all that well and so I'm not sure how this
is intended to work.  I wonder if there are other scenarios to be
concerned with.

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

  parent reply	other threads:[~2023-12-31 20:02 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 [this message]
2023-12-31 20:45 ` tromey at sourceware dot org
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-BXLUoiIJyt@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).