Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH RFA] lin-lwp.c pending events.
Date: Mon, 04 Jun 2001 20:18:00 -0000	[thread overview]
Message-ID: <3B1C4F90.3628FCA2@cygnus.com> (raw)

Mark, even though we are 'co-maintainers' of this code, 
I do like to get your approval and feedback.  Linus threads
are so horrendously complicated, it's good to have two 
pairs of eyes.

This change catches the somewhat rare circumstance where GDB 
calls target_resume with a specific PTID, but then calls 
target_wait with a wild-card.  You could argue that GDB
shouldn't do that, but it turns out that it would be very
difficult to prevent it.  When it happens, we want to 
make sure that we don't try to handle a 'pending' event
from a different LWP, because breakpoints may not be inserted
and that different LWP will run away.
2001-06-04  Michael Snyder  <msnyder@redhat.com>

	* lin-lwp.c (lin_lwp_resume): Set global 'solo_resume_pid' if
	resuming only one LWP.
	(lin_lwp_wait): Use global 'solo_resume_pid' to reject pending
	events if they belong to the wrong LWP.

Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 lin-lwp.c
*** lin-lwp.c	2001/05/15 00:13:47	1.20
--- lin-lwp.c	2001/06/05 02:58:29
*************** resume_callback (struct lwp_info *lp, vo
*** 468,473 ****
--- 468,475 ----
    return 0;
  }
  
+ static pid_t solo_resume_pid = -1;
+ 
  static void
  lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
  {
*************** lin_lwp_resume (ptid_t ptid, int step, e
*** 479,484 ****
--- 481,490 ----
       id'.  But if STEP is zero, then PID means `continue *all*
       processes, but give the signal only to this one'.  */
    resume_all = (PIDGET (ptid) == -1) || !step;
+   if (resume_all)
+     solo_resume_pid = -1;
+   else
+     solo_resume_pid = GET_LWP (ptid);
  
    /* If PID is -1, it's the current inferior that should be
       handled special.  */
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 670,678 ****
    /* First check if there is a LWP with a wait status pending.  */
    if (pid == -1)
      {
!       /* Any LWP will do.  */
        lp = iterate_over_lwps (status_callback, NULL);
!       if (lp)
  	{
  	  if (debug_lin_lwp)
  	    fprintf_unfiltered (gdb_stdlog, 
--- 676,688 ----
    /* First check if there is a LWP with a wait status pending.  */
    if (pid == -1)
      {
!       /* We are asked to wait for any LWP.  */
        lp = iterate_over_lwps (status_callback, NULL);
!       /* However, if we resumed only one LWP, then we should accept 
! 	 a pending wait status only for the same LWP.  Otherwise we may 
!          really confuse GDB.  */
!       if (lp &&
! 	  (solo_resume_pid == -1 || solo_resume_pid == GET_LWP (lp->ptid)))
  	{
  	  if (debug_lin_lwp)
  	    fprintf_unfiltered (gdb_stdlog, 
From jimb@zwingli.cygnus.com Mon Jun 04 22:05:00 2001
From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Fernando Nasser <fnasser@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: tighten apropos pattern
Date: Mon, 04 Jun 2001 22:05:00 -0000
Message-id: <npelsz8qie.fsf@zwingli.cygnus.com>
References: <20010604220622.BC1095E9CB@zwingli.cygnus.com> <3B1C271A.EEADF8EC@cygnus.com>
X-SW-Source: 2001-06/msg00037.html
Content-length: 383

Fernando Nasser <fnasser@cygnus.com> writes:
> Jim Blandy wrote:
> > 
> > 2001-06-04  Jim Blandy  <jimb@redhat.com>
> > 
> >         * gdb.base/help.exp: Update pattern to excluse `print-load-map'
>                                                  ^^^^^^^
> 
> I guess you've meant exclude (s and d are just too close).
> 
> Yes, it is approved.

Committed, with your fix.  Thanks.


             reply	other threads:[~2001-06-04 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 20:18 Michael Snyder [this message]
     [not found] <3B1C51FD.95EED165@cygnus.com>
2001-06-06 12:52 ` Mark Kettenis
2001-06-06 15:05   ` Michael Snyder
2001-06-07 12:34     ` 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=3B1C4F90.3628FCA2@cygnus.com \
    --to=msnyder@cygnus.com \
    --cc=gdb-patches@sources.redhat.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