GNU Binutils with patches for OS216
Révision | cd8f80dc7f1488184d8968b1adb71986027402b5 (tree) |
---|---|
l'heure | 2006-09-14 11:26:04 |
Auteur | Nick Roberts <nickrob@snap...> |
Commiter | Nick Roberts |
(linux_nat_resume): Move async stuff from
i386_linux_resume to here.
(linux_nat_attach): Add initial process for sync too.
@@ -48,6 +48,7 @@ | ||
48 | 48 | #include "gdbthread.h" /* for struct thread_info etc. */ |
49 | 49 | #include "gdb_stat.h" /* for struct stat */ |
50 | 50 | #include <fcntl.h> /* for O_RDONLY */ |
51 | +#include "inf-loop.h" | |
51 | 52 | #include "async-nat-inferior.h" |
52 | 53 | |
53 | 54 | #ifndef O_LARGEFILE |
@@ -1005,19 +1006,20 @@ linux_nat_attach (char *args, int from_tty) | ||
1005 | 1006 | attach all of them. */ |
1006 | 1007 | linux_ops->to_attach (args, from_tty); |
1007 | 1008 | |
1009 | + /* Add the initial process as the first LWP to the list. */ | |
1010 | + inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)); | |
1011 | + lp = add_lwp (inferior_ptid); | |
1012 | + | |
1008 | 1013 | if (!target_can_async_p ()) |
1009 | 1014 | { |
1010 | - /* Add the initial process as the first LWP to the list. */ | |
1011 | - inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)); | |
1012 | - lp = add_lwp (inferior_ptid); | |
1013 | - | |
1014 | 1015 | /* Make sure the initial process is stopped. The user-level threads |
1015 | 1016 | layer might want to poke around in the inferior, and that won't |
1016 | 1017 | work if things haven't stabilized yet. */ |
1017 | 1018 | pid = my_waitpid (GET_PID (inferior_ptid), &status, 0); |
1018 | 1019 | if (pid == -1 && errno == ECHILD) |
1019 | 1020 | { |
1020 | - warning (_("%s is a cloned process"), target_pid_to_str (inferior_ptid)); | |
1021 | + warning (_("%s is a cloned process"), | |
1022 | + target_pid_to_str (inferior_ptid)); | |
1021 | 1023 | |
1022 | 1024 | /* Try again with __WCLONE to check cloned processes. */ |
1023 | 1025 | pid = my_waitpid (GET_PID (inferior_ptid), &status, __WCLONE); |
@@ -1162,6 +1164,7 @@ resume_set_callback (struct lwp_info *lp, void *data) | ||
1162 | 1164 | static void |
1163 | 1165 | linux_nat_resume (ptid_t ptid, int step, enum target_signal signo) |
1164 | 1166 | { |
1167 | + struct target_waitstatus status; | |
1165 | 1168 | struct lwp_info *lp; |
1166 | 1169 | int resume_all; |
1167 | 1170 |
@@ -1251,6 +1254,26 @@ linux_nat_resume (ptid_t ptid, int step, enum target_signal signo) | ||
1251 | 1254 | iterate_over_lwps (resume_callback, NULL); |
1252 | 1255 | |
1253 | 1256 | linux_ops->to_resume (ptid, step, signo); |
1257 | + | |
1258 | + if (target_can_async_p ()) | |
1259 | + { | |
1260 | + status.kind = TARGET_WAITKIND_SPURIOUS; | |
1261 | + gdb_process_events (gdb_status, &status, 0, 0); | |
1262 | + | |
1263 | + if (gdb_post_pending_event ()) | |
1264 | + { | |
1265 | + /* QUESTION: Do I need to lie about target_executing here? */ | |
1266 | + if (target_is_async_p ()) | |
1267 | + target_executing = 1; | |
1268 | + return; | |
1269 | + } | |
1270 | + | |
1271 | + target_async (inferior_event_handler, 0); | |
1272 | + } | |
1273 | + | |
1274 | + if (target_is_async_p ()) | |
1275 | + target_executing = 1; | |
1276 | + | |
1254 | 1277 | if (debug_linux_nat) |
1255 | 1278 | fprintf_unfiltered (gdb_stdlog, |
1256 | 1279 | "LLR: %s %s, %s (resume event thread)\n", |