Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <drow@false.org>,
	 Mark Kettenis <mark.kettenis@xs4all.nl>
Subject: Re: [PATCH/RFC] Signals & single-stepping
Date: Thu, 01 Oct 2009 16:14:00 -0000	[thread overview]
Message-ID: <200910011715.01074.pedro@codesourcery.com> (raw)
In-Reply-To: <200910011551.19751.pedro@codesourcery.com>

On Thursday 01 October 2009 15:51:18, Pedro Alves wrote:
> On Wednesday 30 September 2009 17:25:13, Daniel Jacobowitz wrote:
> > Your patch doesn't reintroduce the problem from the PR, and the new
> > tests in interrupt.exp pass on x86_64-linux.  I would really love
> > someone else to volunteer to review it though - trap_expected confuses
> > me horribly.  I'd guess this change could lead to hitting (and
> > displaying) the breakpoint at the current PC a second time, which is
> > undesirable.
> 
> Yes, this messes with hit counts, reruns user breakpoint
> commands, etc.  Even some internal breakpoints don't like to
> be re-hit for no reason.  E.g., see linux-thread-db.c:check_event
> "Cannot get thread event message".
> 
> I think the issue is that when stepping over a breakpoint,
> for simplicity, GDB always removes all breakpoints.  What if
> we made it remove only breakpoints at stop_pc?

Bah, this would miss the same breakpoint we're stepping over,
if the signal handler calls it:

void
sighandler (int signo)
{
  foo ();
}

void
foo ()
{
}

(gdb) b foo
(gdb) c
<stopped at foo>
(gdb) signal SIGUSR1
<the foo call in signal handler is missed on targets
that can't step into signal handlers>

If we go the breakpoint re-hit path, it would be
nicer if we detected rehits and ignore them.  I'm not sure
how to distinguish the situation above from a rehit
due to single-stepping the breakpoint insn -- check
if the current frame id changed?  If we go that
path, we should perhaps also declare that code that
checks for breakpoint hits behind infrun.c's back
(like that check_event) should be more permissive of
re-hits, or otherwise be moved to the core stop
bpstat mechanism.

There may be other issues with rehits I haven't
thought of.  I'm just thinking out loud.

-- 
Pedro Alves


  reply	other threads:[~2009-10-01 16:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 14:41 Mark Kettenis
2009-09-30 16:25 ` Daniel Jacobowitz
2009-10-01 14:51   ` Pedro Alves
2009-10-01 16:14     ` Pedro Alves [this message]
2009-10-01 16:44       ` Daniel Jacobowitz

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=200910011715.01074.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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