Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH RFA] Clean up spurious SIGSTOPS in lin-lwp
@ 2001-05-25 15:57 Michael Snyder
  2001-05-26  2:15 ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2001-05-25 15:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: kettenis

Mark, 

This patch will get rid of most of those "Delayed SIGSTOP" messages, 
so that lin_lwp_wait will rarely if ever get a SIGSTOP that was generated
by gdb.  It entails three basic changes:

 * In lin_lwp_attach_lwp, consume the SIGSTOP that is generated by
   PTHREAD_ATTACH.
 * In stop_wait_callback, try again to consume the SIGSTOP after
   "pushing back" a SIGTRAP for a thread other than the event thread.
 * Similarly try again to consume a SIGSTOP after tossing away a
   redundant SIGINT.

Michael
2001-05-25  Michael Snyder  <msnyder@redhat.com>

	* lin-lwp.c (lin_lwp_attach_lwp): Call stop_wait_callback,
	to consume the SIGSTOP generated by PTRACE_ATTACH.
	(stop_wait_callback): If a SIGTRAP or a SIGINT event is consumed,
	try again to get the SIGSTOP event.
	(lin_lwp_wait): Resume all threads when ignoring a signal.
	This will insure that newly attached threads get resumed.

*** lin-lwp.sigint.c	Fri May 25 15:23:46 2001
--- lin-lwp.c	Fri May 25 15:26:52 2001
*************** lin_lwp_attach_lwp (ptid_t ptid, int ver
*** 327,333 ****
      lp = add_lwp (ptid);
  
    if (is_cloned (ptid))
!     lp->signalled = 1;
  }
  
  static void
--- 327,336 ----
      lp = add_lwp (ptid);
  
    if (is_cloned (ptid))
!     {
!       lp->signalled = 1;
!       stop_wait_callback (lp, NULL);
!     }
  }
  
  static void
*************** stop_callback (struct lwp_info *lp, void
*** 539,544 ****
--- 542,548 ----
  static int
  stop_wait_callback (struct lwp_info *lp, void *data)
  {
+  get_another_event:
    if (! lp->stopped && lp->signalled)
      {
        pid_t pid;
*************** stop_wait_callback (struct lwp_info *lp,
*** 609,614 ****
--- 613,624 ----
  		write_pc_pid (read_pc_pid (pid_to_ptid (pid)) 
  		                - DECR_PC_AFTER_BREAK,
  			      pid_to_ptid (pid));
+ 
+ 	      /* Now resume this LWP and get the SIGSTOP event. */
+ 	      lp->stopped = 1;
+ 	      lp->step = 0;
+ 	      resume_callback (lp, NULL);
+ 	      goto get_another_event;
  	    }
  	  else if (WSTOPSIG (status) == SIGINT)
  	    {
*************** stop_wait_callback (struct lwp_info *lp,
*** 616,622 ****
  		 (in the case where ^C/BREAK is typed at the tty/console),
  		 just ignore all SIGINT events from all lwp's except for
  		 the one that was caught by lin_lwp_wait.  */
! 	      ;  /* Don't save.  Signal will disappear into oblivion. */
  	    }
  	  else
  	    {
--- 626,637 ----
  		 (in the case where ^C/BREAK is typed at the tty/console),
  		 just ignore all SIGINT events from all lwp's except for
  		 the one that was caught by lin_lwp_wait.  */
! 
! 	      /* Now resume this LWP and get the SIGSTP event. */
! 	      lp->stopped = 1;
! 	      lp->step = 0;
! 	      resume_callback (lp, NULL);
! 	      goto get_another_event;
  	    }
  	  else
  	    {
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 867,874 ****
  	  && signal_print_state (signo) == 0
  	  && signal_pass_state (signo) == 1)
  	{
- 	  child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
  	  lp->stopped = 0;
  	  status = 0;
  	  goto retry;
  	}
--- 882,893 ----
  	  && signal_print_state (signo) == 0
  	  && signal_pass_state (signo) == 1)
  	{
  	  lp->stopped = 0;
+ 	  /* Resume all threads except this one
+ 	     (mainly to get the newly attached ones). */
+ 	  iterate_over_lwps (resume_callback, NULL);
+ 	  /* Now resume this thread, forwarding the signal to it. */
+ 	  child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
  	  status = 0;
  	  goto retry;
  	}
From kevinb@cygnus.com Fri May 25 16:33:00 2001
From: Kevin Buettner <kevinb@cygnus.com>
To: Nick Duffek <nsd@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] solib-osf.c: reimplement osfsolib.c as solib.c backend
Date: Fri, 25 May 2001 16:33:00 -0000
Message-id: <1010525233258.ZM16610@ocotillo.lan>
References: <200105250215.f4P2FCs07063@rtl.cygnus.com> <nsd@redhat.com>
X-SW-Source: 2001-05/msg00469.html
Content-length: 1268

On May 24, 10:15pm, Nick Duffek wrote:

> The appended patch reimplements osfsolib.c as a back end to the generic
> shared library support framework in solib.c.
> 
> For consistency with other such back ends, I renamed it to solib-osf.c.
> 
> ChangeLog:
> 
> 	* Makefile.in (osfsolib.c, osfsolib.o): Rename to solib-osf.c and
> 	solib-osf.o.
> 	* config/alpha/alpha-osf1.mh (NATDEPFILES): Replace osfsolib.o
> 	with solib-osf.o and solib.o.
> 	* config/alpha/alpha-osf2.mh: Likewise.
> 	* config/alpha/alpha-osf3.mh: Likewise.
> 	* solib-osf.c: New file, renamed and largely rewritten from
> 	osfsolib.c.
> 
> Tested on alphaev6-dec-osf5.1 and alpha-dec-osf4.0 with preceding patch to
> solib.c.  Okay to apply?

Yes, approved.  (I *can* approve this, can't I?)

A couple of comments though...

1) I see some code disabled with #if 0 in solib-osf.c.  Is there a
   reason for retaining this code?  (I did read your comment and if
   you think someone might want to reenable ldr_read_memory() at some
   time in the future, then by all means keep it.)

2) _initialize_osf_solib() should probably have an extern declaration
   at the top of the file.  I realize that this shouldn't be necessary,
   but it eliminates the warning when using -Wmissing-prototypes.

Kevin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-05-30 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25 15:57 [PATCH RFA] Clean up spurious SIGSTOPS in lin-lwp Michael Snyder
2001-05-26  2:15 ` Mark Kettenis
2001-05-30 16:03   ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox