Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Don't set random_signal for single step breakpoint
Date: Mon, 26 Sep 2016 12:43:00 -0000	[thread overview]
Message-ID: <b6e5ae16-fc40-1fa8-e729-e0586b00db73@redhat.com> (raw)
In-Reply-To: <1474866074-21720-1-git-send-email-yao.qi@linaro.org>

On 09/26/2016 01:01 AM, Yao Qi wrote:
> I happen to see the code, and find the comments are out of date,
> because single-step breakpoint is not transparent to the breakpoint
> module.  If one thread hits another thread's single-step breakpoint,
> random_signal should be zero.  IOW, if random_signal is one, the
> thread shouldn't hit any single-step breakpoints.  This patch is to
> remove this piece of code.

Hmm, not sure.  This hunk does predate the move to have single-step
breakpoints be regular breakpoints, but, OTOH, the single-step breakpoints
are deleted before the bpstat handling takes place:

  /* Pull the single step breakpoints out of the target.  */
  if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
    {
...
     /* However, before doing so, if this single-step breakpoint was
	 actually for another thread, set this thread up for moving
	 past it.  */
      if (!thread_has_single_step_breakpoint_here (ecs->event_thread,
						   aspace, pc))
	{
	  if (single_step_breakpoint_inserted_here_p (aspace, pc))
	    {
	      ecs->hit_singlestep_breakpoint = 1;
...
  delete_just_stopped_threads_single_step_breakpoints ();


  bpstat_clear (&ecs->event_thread->control.stop_bpstat);

...
  ecs->event_thread->control.stop_bpstat
    = bpstat_stop_status (get_regcache_aspace (get_current_regcache ()),
			  stop_pc, ecs->ptid, &ecs->ws);

  /* See if the breakpoints module can explain the signal.  */
  random_signal
    = !bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
			       ecs->event_thread->suspend.stop_signal);


So I wonder whether this:

  /* Maybe this was a trap for a software breakpoint that has since
     been removed.  */
  if (random_signal && target_stopped_by_sw_breakpoint ())
    {

is masking the need for the hunk you're proposing to remove.
What happens if you hack your target to no longer support
target_stopped_by_sw_breakpoint ?

The commit that added the code in question (2adfaa28b5,
eliminate thread-hop code) predates that (the whole
moribund breakpoints -> siginfo.si_code change).

Thanks,
Pedro Alves


      reply	other threads:[~2016-09-26 11:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 11:16 Yao Qi
2016-09-26 12:43 ` Pedro Alves [this message]

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=b6e5ae16-fc40-1fa8-e729-e0586b00db73@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /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