Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb@sourceware.org,  drow@false.org
Subject: Re: Regression
Date: Tue, 10 Feb 2009 19:05:00 -0000	[thread overview]
Message-ID: <200902101905.37812.pedro@codesourcery.com> (raw)
In-Reply-To: <200902101839.n1AId4Mb031903@brahms.sibelius.xs4all.nl>

On Tuesday 10 February 2009 18:39:04, Mark Kettenis wrote:
> I've looked at the PR mentioned in the commi message, and I don't
> quite understand how the change to the signal command has anything to
> do with that.

Before Daniel's Daniel's patch, `signal_command' called `proceed'
like so:

+  proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);

For a signal != TARGET_SIGNAL_0, say signal FOO, that's effectivelly this:

 proceed (stop_pc, oursig, 0);



void
proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
{
(...)
  if (addr == (CORE_ADDR) -1)
    {
      if (pc == stop_pc && breakpoint_here_p (pc) 
	  && execution_direction != EXEC_REVERSE)
	/* There is a breakpoint at the address we will resume at,
	   step one instruction before inserting breakpoints so that
	   we do not stop right away (and report a second hit at this
	   breakpoint).

	   Note, we don't do this in reverse, because we won't
	   actually be executing the breakpoint insn anyway.
	   We'll be (un-)executing the previous instruction.  */

	oneproc = 1;
      else if (gdbarch_single_step_through_delay_p (gdbarch)
	       && gdbarch_single_step_through_delay (gdbarch,
						     get_current_frame ()))
	/* We stepped onto an instruction that needs to be stepped
	   again before re-inserting the breakpoint, do so.  */
	oneproc = 1;
    }
  else
    {
      regcache_write_pc (regcache, addr);
    }
(...)

This messed with syscall restarting on linux, since it was
writing the PC.  

Notice that the (addr != (CORE_ADDR) -1) code path doesn't
set `oneproc', hence, ends up *not* removing
breakpoints, and *not* single-stepping, even if we were stopped
at a breakpoint.  That is what I call the "jump" behaviour --- a jump
to $PC hits a breakpoint at $PC.

After Daniel's change, signal_command does this unconditionaly:

 proceed ((CORE_ADDR) -1, oursig, 0);

Which means we now go through the "(addr == (CORE_ADDR) -1)"
branch above.  This avoided the regcache_write_pc call.   But, it also
sets `oneproc' because in this case, there's a breakpoint at
stop_pc, and PC is still at stop_pc.  That will make us remove
breakpoints from the inferior, and call `resume' with step=1.
The part that's breakpoint the BSDs is the fact that we now
remove breakpoints from the inferior.

-- 
Pedro Alves


  reply	other threads:[~2009-02-10 19:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10 15:17 Regression Mark Kettenis
2009-02-10 15:27 ` Regression Daniel Jacobowitz
2009-02-10 15:47   ` Regression Mark Kettenis
2009-02-10 16:06     ` Regression Pedro Alves
2009-02-10 16:18       ` Regression Tristan Gingold
2009-02-10 18:00       ` Regression Pedro Alves
2009-02-10 18:40         ` Regression Mark Kettenis
2009-02-10 19:05           ` Pedro Alves [this message]
2009-02-10 19:18             ` Regression Pedro Alves
2009-02-10 19:27               ` Regression Pedro Alves
2009-02-11 15:50                 ` Regression Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2009-02-10 15:14 Regression Mark Kettenis

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=200902101905.37812.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=drow@false.org \
    --cc=gdb@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