* [RFA]: handle_extended_wait: Call linux_resume_one_lwp instead of ptrace
@ 2009-05-24 3:14 Doug Evans
2009-05-24 17:00 ` Pedro Alves
0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2009-05-24 3:14 UTC (permalink / raw)
To: gdb-patches
Hi.
There are some things that linux_resume_one_lwp does that either
all callers of ptrace (PTRACE_CONT) should do (check errno)
or would be nice to do (print a debugging message).
I was thinking of splitting linux_resume_one_lwp into two,
but since the newly created thread is, well, new the rest of
linux_resume_one_lwp is a nop; so it seems reasonable to just call
linux_resume_one_lwp for the new thread.
It's also nice to have all calls to ptrace (PTRACE_CONT)
routed through one function.
Ok to check in?
[tested on amd64 w/ --target_board=native-gdbserver, no regressions]
2009-05-23 Doug Evans <dje@google.com>
* linux-low.c (handle_extended_wait): Use linux_resume_one_lwp
to resume the newly created thread, don't call ptrace (PTRACE_CONT)
directly.
Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.103
diff -u -p -r1.103 linux-low.c
--- linux-low.c 24 May 2009 01:09:22 -0000 1.103
+++ linux-low.c 24 May 2009 03:00:53 -0000
@@ -295,29 +295,32 @@ handle_extended_wait (struct lwp_info *e
new_lwp = (struct lwp_info *) add_lwp (ptid);
add_thread (ptid, new_lwp);
+ /* Either we're going to immediately resume the new thread
+ or leave it stopped. linux_resume_one_lwp is a nop if it
+ thinks the thread is currently running, so set this first
+ before calling linux_resume_one_lwp. */
+ new_lwp->stopped = 1;
+
/* Normally we will get the pending SIGSTOP. But in some cases
we might get another signal delivered to the group first.
If we do get another signal, be sure not to lose it. */
if (WSTOPSIG (status) == SIGSTOP)
{
- if (stopping_threads)
- new_lwp->stopped = 1;
- else
- ptrace (PTRACE_CONT, new_pid, 0, 0);
+ if (! stopping_threads)
+ linux_resume_one_lwp (new_lwp, 0, 0, NULL);
}
else
{
new_lwp->stop_expected = 1;
if (stopping_threads)
{
- new_lwp->stopped = 1;
new_lwp->status_pending_p = 1;
new_lwp->status_pending = status;
}
else
/* Pass the signal on. This is what GDB does - except
shouldn't we really report it instead? */
- ptrace (PTRACE_CONT, new_pid, 0, WSTOPSIG (status));
+ linux_resume_one_lwp (new_lwp, 0, WSTOPSIG (status), NULL);
}
/* Always resume the current thread. If we are stopping
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [RFA]: handle_extended_wait: Call linux_resume_one_lwp instead of ptrace
2009-05-24 3:14 [RFA]: handle_extended_wait: Call linux_resume_one_lwp instead of ptrace Doug Evans
@ 2009-05-24 17:00 ` Pedro Alves
0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2009-05-24 17:00 UTC (permalink / raw)
To: gdb-patches; +Cc: Doug Evans
On Sunday 24 May 2009 04:14:22, Doug Evans wrote:
> There are some things that linux_resume_one_lwp does that either
> all callers of ptrace (PTRACE_CONT) should do (check errno)
> or would be nice to do (print a debugging message).
> I was thinking of splitting linux_resume_one_lwp into two,
> but since the newly created thread is, well, new the rest of
> linux_resume_one_lwp is a nop; so it seems reasonable to just call
> linux_resume_one_lwp for the new thread.
> It's also nice to have all calls to ptrace (PTRACE_CONT)
> routed through one function.
Agreed. It doesn't look like there are extra syscalls and
it's all O(1) in that fast path.
>
> Ok to check in?
> [tested on amd64 w/ --target_board=native-gdbserver, no regressions]
>
> 2009-05-23 Doug Evans <dje@google.com>
>
> * linux-low.c (handle_extended_wait): Use linux_resume_one_lwp
> to resume the newly created thread, don't call ptrace (PTRACE_CONT)
> directly.
Ok.
--
Pedro Alves
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-24 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-24 3:14 [RFA]: handle_extended_wait: Call linux_resume_one_lwp instead of ptrace Doug Evans
2009-05-24 17:00 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox