diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6bb6bbf..04d112e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -456,6 +456,8 @@ show_always_inserted_mode (struct ui_file *file, int from_tty, value); } +#include "linux-nat.h" + /* See breakpoint.h. */ int @@ -479,15 +481,31 @@ breakpoints_should_be_inserted_now (void) return 1; } +update_threads_executing(); if (threads_are_executing ()) +{ +fprintf(stderr,"executing\n"); return 1; +} /* Don't remove breakpoints yet if, even though all threads are stopped, we still have events to process. */ - ALL_NON_EXITED_THREADS (tp) - if (tp->resumed - && tp->suspend.waitstatus_pending_p) - return 1; + ALL_NON_EXITED_THREADS (tp) { +fprintf(stderr,"iter:<%d,%ld,%ld> resumed=%d suspend.waitstatus_pending_p=%d executing=%d\n", + tp->ptid.pid,tp->ptid.lwp,tp->ptid.tid, + tp->resumed,tp->suspend.waitstatus_pending_p,tp->executing); + if ((tp->resumed && tp->suspend.waitstatus_pending_p) || tp->executing) + { + extern struct lwp_info *find_lwp_pid (ptid_t ptid); + struct lwp_info *lp = find_lwp_pid (tp->ptid); + +fprintf(stderr,"lp->must_set_ptrace_flags=%d\n",(!lp?-1:lp->must_set_ptrace_flags)); + if (lp != NULL && lp->must_set_ptrace_flags) + continue; + + return 1; + } +} } return 0; } diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index af2dc86..22603da 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -575,6 +575,7 @@ extern struct cleanup *make_cleanup_restore_current_thread (void); extern struct thread_info* inferior_thread (void); extern void update_thread_list (void); +extern void update_threads_executing (void); /* Delete any thread the target says is no longer alive. */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 70d7a09..996bfbe 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4615,10 +4615,12 @@ stop_all_threads (void) t = add_thread (event_ptid); t->stop_requested = 0; - t->executing = 0; t->resumed = 0; t->control.may_range_step = 0; + t->executing = 0; + update_threads_executing (); + /* This may be the first time we see the inferior report a stop. */ inf = find_inferior_ptid (event_ptid); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 5d5efa0..11d7f11 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -302,7 +302,7 @@ struct lwp_info; static struct lwp_info *add_lwp (ptid_t ptid); static void purge_lwp_list (int pid); static void delete_lwp (ptid_t ptid); -static struct lwp_info *find_lwp_pid (ptid_t ptid); +struct lwp_info *find_lwp_pid (ptid_t ptid); static int lwp_status_pending_p (struct lwp_info *lp); @@ -949,7 +949,7 @@ delete_lwp (ptid_t ptid) /* Return a pointer to the structure describing the LWP corresponding to PID. If no corresponding LWP could be found, return NULL. */ -static struct lwp_info * +struct lwp_info * find_lwp_pid (ptid_t ptid) { struct lwp_info *lp; @@ -1180,6 +1180,7 @@ attach_proc_task_lwp_callback (ptid_t ptid) /* Also add the LWP to gdb's thread list, in case a matching libthread_db is not found (or the process uses raw clone). */ +fprintf(stderr,"adding:<%d,%ld,%ld>\n",lp->ptid.pid,lp->ptid.lwp,lp->ptid.tid); add_thread (lp->ptid); set_running (lp->ptid, 1); set_executing (lp->ptid, 1); diff --git a/gdb/thread.c b/gdb/thread.c index a66a2b5..d9dcd28 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -2095,10 +2095,12 @@ gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message) return GDB_RC_OK; } +#include "linux-nat.h" + /* Update the 'threads_executing' global based on the threads we know about right now. */ -static void +void update_threads_executing (void) { struct thread_info *tp; @@ -2108,6 +2110,13 @@ update_threads_executing (void) { if (tp->executing) { + extern struct lwp_info *find_lwp_pid (ptid_t ptid); + struct lwp_info *lp = find_lwp_pid (tp->ptid); + +fprintf(stderr,"update_threads_executing: lp->must_set_ptrace_flags=%d\n",(!lp?-1:lp->must_set_ptrace_flags)); + if (lp != NULL && lp->must_set_ptrace_flags) + continue; + threads_executing = 1; break; }