diff options
author | Pedro Alves <palves@redhat.com> | 2009-05-06 17:32:59 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-05-06 17:32:59 +0000 |
commit | a6dbe5dfa522e405c297014002cac82f05a4dc68 (patch) | |
tree | 8acbd7656fecab4a70d39d688b37ee35024787be /gdb | |
parent | a562dc8f5a5930afaa5ffb3e98200e21dd8b724a (diff) | |
download | gdb-a6dbe5dfa522e405c297014002cac82f05a4dc68.zip gdb-a6dbe5dfa522e405c297014002cac82f05a4dc68.tar.gz gdb-a6dbe5dfa522e405c297014002cac82f05a4dc68.tar.bz2 |
PR server/10048
* linux-low.c (must_set_ptrace_flags): Delete.
(linux_create_inferior): Set `lwp->must_set_ptrace_flags' instead
of the global.
(linux_attach_lwp_1): Don't set PTRACE_SETOPTIONS here. Set
`lwp->must_set_ptrace_flags' instead.
(linux_wait_for_event_1): If ptrace options here.
(linux_wait_1): ... not here.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 27 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.h | 4 |
3 files changed, 30 insertions, 13 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index d710f61..49a395d 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,15 @@ +2009-05-06 Pedro Alves <pedro@codesourcery.com> + + PR server/10048 + + * linux-low.c (must_set_ptrace_flags): Delete. + (linux_create_inferior): Set `lwp->must_set_ptrace_flags' instead + of the global. + (linux_attach_lwp_1): Don't set PTRACE_SETOPTIONS here. Set + `lwp->must_set_ptrace_flags' instead. + (linux_wait_for_event_1): If ptrace options here. + (linux_wait_1): ... not here. + 2009-04-30 Doug Evans <dje@google.com> * inferiors.c (started_inferior_callback): New function. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index a6bad39..bf17904 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -109,8 +109,6 @@ int stopping_threads; /* FIXME make into a target method? */ int using_threads = 1; -static int must_set_ptrace_flags; - /* This flag is true iff we've just created or attached to our first inferior but it has not stopped yet. As soon as it does, we need to call the low target's arch_setup callback. Doing this only on @@ -319,7 +317,7 @@ add_lwp (ptid_t ptid) static int linux_create_inferior (char *program, char **allargs) { - void *new_lwp; + struct lwp_info *new_lwp; int pid; ptid_t ptid; @@ -354,7 +352,7 @@ linux_create_inferior (char *program, char **allargs) ptid = ptid_build (pid, pid, 0); new_lwp = add_lwp (ptid); add_thread (ptid, new_lwp); - must_set_ptrace_flags = 1; + new_lwp->must_set_ptrace_flags = 1; return pid; } @@ -383,10 +381,6 @@ linux_attach_lwp_1 (unsigned long lwpid, int initial) strerror (errno), errno); } - /* FIXME: This intermittently fails. - We need to wait for SIGSTOP first. */ - ptrace (PTRACE_SETOPTIONS, lwpid, 0, PTRACE_O_TRACECLONE); - if (initial) /* NOTE/FIXME: This lwp might have not been the tgid. */ ptid = ptid_build (lwpid, lwpid, 0); @@ -402,6 +396,11 @@ linux_attach_lwp_1 (unsigned long lwpid, int initial) new_lwp = (struct lwp_info *) add_lwp (ptid); add_thread (ptid, new_lwp); + + /* We need to wait for SIGSTOP before being able to make the next + ptrace call on this LWP. */ + new_lwp->must_set_ptrace_flags = 1; + /* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH brings it to a halt. @@ -996,6 +995,13 @@ linux_wait_for_event_1 (ptid_t ptid, int *wstat, int options) continue; } + if (event_child->must_set_ptrace_flags) + { + ptrace (PTRACE_SETOPTIONS, lwpid_of (event_child), + 0, PTRACE_O_TRACECLONE); + event_child->must_set_ptrace_flags = 0; + } + if (WIFSTOPPED (*wstat) && WSTOPSIG (*wstat) == SIGSTOP && event_child->stop_expected) @@ -1258,11 +1264,6 @@ retry: lwp = get_thread_lwp (current_inferior); - if (must_set_ptrace_flags) - { - ptrace (PTRACE_SETOPTIONS, lwpid_of (lwp), 0, PTRACE_O_TRACECLONE); - must_set_ptrace_flags = 0; - } /* If we are waiting for a particular child, and it exited, linux_wait_for_event will return its exit status. Similarly if the last child exited. If this is not the last child, however, diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index b076c5d..fc93a0e 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -146,6 +146,10 @@ struct lwp_info was a single-step. */ int stepping; + /* If this flag is set, we need to set the event request flags the + next time we see this LWP stop. */ + int must_set_ptrace_flags; + /* If this is non-zero, it points to a chain of signals which need to be delivered to this process. */ struct pending_signals *pending_signals; |