summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2006-09-14 02:26:04 +0000
committerNick Roberts <nickrob@snap.net.nz>2006-09-14 02:26:04 +0000
commit3f7b9951f256ff1ea799fa6135df63a3152c67dd (patch)
treeebc366ca15813f25f70283c8d5606eec0753bc90
parent08c704252b267c313e14056a53f80f3bfdb3b3f7 (diff)
downloadgdb-3f7b9951f256ff1ea799fa6135df63a3152c67dd.tar.gz
(linux_nat_resume): Move async stuff from
i386_linux_resume to here. (linux_nat_attach): Add initial process for sync too.
-rw-r--r--gdb/linux-nat.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index f5c3fafc9ff..11e0d694d2b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -48,6 +48,7 @@
#include "gdbthread.h" /* for struct thread_info etc. */
#include "gdb_stat.h" /* for struct stat */
#include <fcntl.h> /* for O_RDONLY */
+#include "inf-loop.h"
#include "async-nat-inferior.h"
#ifndef O_LARGEFILE
@@ -1005,19 +1006,20 @@ linux_nat_attach (char *args, int from_tty)
attach all of them. */
linux_ops->to_attach (args, from_tty);
+ /* Add the initial process as the first LWP to the list. */
+ inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
+ lp = add_lwp (inferior_ptid);
+
if (!target_can_async_p ())
{
- /* Add the initial process as the first LWP to the list. */
- inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
- lp = add_lwp (inferior_ptid);
-
/* Make sure the initial process is stopped. The user-level threads
layer might want to poke around in the inferior, and that won't
work if things haven't stabilized yet. */
pid = my_waitpid (GET_PID (inferior_ptid), &status, 0);
if (pid == -1 && errno == ECHILD)
{
- warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid));
+ warning (_("%s is a cloned process"),
+ target_pid_to_str (inferior_ptid));
/* Try again with __WCLONE to check cloned processes. */
pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
@@ -1162,6 +1164,7 @@ resume_set_callback (struct lwp_info *lp, void *data)
static void
linux_nat_resume (ptid_t ptid, int step, enum target_signal signo)
{
+ struct target_waitstatus status;
struct lwp_info *lp;
int resume_all;
@@ -1251,6 +1254,26 @@ linux_nat_resume (ptid_t ptid, int step, enum target_signal signo)
iterate_over_lwps (resume_callback, NULL);
linux_ops->to_resume (ptid, step, signo);
+
+ if (target_can_async_p ())
+ {
+ status.kind = TARGET_WAITKIND_SPURIOUS;
+ gdb_process_events (gdb_status, &status, 0, 0);
+
+ if (gdb_post_pending_event ())
+ {
+ /* QUESTION: Do I need to lie about target_executing here? */
+ if (target_is_async_p ())
+ target_executing = 1;
+ return;
+ }
+
+ target_async (inferior_event_handler, 0);
+ }
+
+ if (target_is_async_p ())
+ target_executing = 1;
+
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",