* [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
* Re: [PATCH RFA] Clean up spurious SIGSTOPS in lin-lwp
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
0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2001-05-26 2:15 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches
Date: Fri, 25 May 2001 15:57:39 -0700
From: Michael Snyder <msnyder@cygnus.com>
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.
In principle the current approach saves us a few system calls, at the
risk of a GDB-generated SIGSTOP colliding with a SIGSTOP that wasn't
generated by GDB.
I assume you're trying to make GDB behave a little better when some
outside agency is generating SIGSTOPs. We have to keep in mind that
as long as SIGSTOP doesn't have Real-Time semantics, we can never
guarantee that things work entirely reliably. The question is whether
we prefer the situation where things clearly don't work correctly if
SIGSTOP is used in the user program (as we have now, although I'm not
sure about that "clearly"), or that we'd rather have things more or
less working correctly, but fail in some corner cases only.
The change to lin_lwp_attach_lwp is a change from
for every thread
send out message
for every thread
collect response
to
for every thread
send out message
collect response
In theory this could make the process slower, making attaching even
more non-atomic than it is already. But we hardly ever attach to more
than one or two LWP's at the same time (only when attaching to an
already running threaded program) so that shouldn't really matter. So
if this change represents a real improvement in GDB's behaviour I
think it's OK.
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFA] Clean up spurious SIGSTOPS in lin-lwp
2001-05-26 2:15 ` Mark Kettenis
@ 2001-05-30 16:03 ` Michael Snyder
0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2001-05-30 16:03 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
Mark Kettenis wrote:
>
> Date: Fri, 25 May 2001 15:57:39 -0700
> From: Michael Snyder <msnyder@cygnus.com>
>
> 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.
>
> In principle the current approach saves us a few system calls, at the
> risk of a GDB-generated SIGSTOP colliding with a SIGSTOP that wasn't
> generated by GDB.
>
> I assume you're trying to make GDB behave a little better when some
> outside agency is generating SIGSTOPs.
No, I'm working on a bug, and trying to simplify parts of the
event handling in order to clear the way. The bug that I'm really
aiming for is a scheduling issue -- gdb can cause some threads
to starve. Don't worry, it isn't your fault, it's been in all of
the linux thread debugging implementations so far. It causes a
couple of failures in the testcase "pthreads.exp". I know in
principal what to do, but in practice it's proving to be tricky.
I've checked in this part of the change.
Michael
^ 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