Automatic date update in version.in
[platform/upstream/binutils.git] / gdb / gdbthread.h
index c3b85dc..26ca925 100644 (file)
@@ -1,5 +1,5 @@
 /* Multi-process/thread control defs for GDB, the GNU debugger.
-   Copyright (C) 1987-2013 Free Software Foundation, Inc.
+   Copyright (C) 1987-2014 Free Software Foundation, Inc.
    Contributed by Lynx Real-Time Systems, Inc.  Los Gatos, CA.
    
 
@@ -122,6 +122,11 @@ struct thread_control_state
   /* Chain containing status of breakpoint(s) the thread stopped
      at.  */
   bpstat stop_bpstat;
+
+  /* The interpreter that issued the execution command.  NULL if the
+     thread was resumed as a result of a command applied to some other
+     thread (e.g., "next" with scheduler-locking off).  */
+  struct interp *command_interp;
 };
 
 /* Inferior thread specific part of `struct infcall_suspend_state'.
@@ -130,7 +135,13 @@ struct thread_control_state
 
 struct thread_suspend_state
 {
-  /* Last signal that the inferior received (why it stopped).  */
+  /* Last signal that the inferior received (why it stopped).  When
+     the thread is resumed, this signal is delivered.  Note: the
+     target should not check whether the signal is in pass state,
+     because the signal may have been explicitly passed with the
+     "signal" command, which overrides "handle nopass".  If the signal
+     should be suppressed, the core will take care of clearing this
+     before the target is resumed.  */
   enum gdb_signal stop_signal;
 };
 
@@ -152,14 +163,12 @@ struct thread_info
      thread is off and running.  */
   int executing;
 
-  /* Frontend view of the thread state.  Note that the RUNNING/STOPPED
-     states are different from EXECUTING.  When the thread is stopped
-     internally while handling an internal event, like a software
-     single-step breakpoint, EXECUTING will be false, but running will
-     still be true.  As a possible future extension, this could turn
-     into enum { stopped, exited, stepping, finishing, until(ling),
-     running ... }  */
-  int state;
+  /* Frontend view of the thread state.  Note that the THREAD_RUNNING/
+     THREAD_STOPPED states are different from EXECUTING.  When the
+     thread is stopped internally while handling an internal event,
+     like a software single-step breakpoint, EXECUTING will be false,
+     but STATE will still be THREAD_RUNNING.  */
+  enum thread_state state;
 
   /* If this is > 0, then it means there's code out there that relies
      on this thread being listed.  Don't delete it from the lists even
@@ -297,11 +306,12 @@ struct thread_info *find_thread_id (int num);
    returns the first thread in the list.  */
 struct thread_info *first_thread_of_process (int pid);
 
-/* Returns any thread of process PID.  */
+/* Returns any thread of process PID, giving preference to the current
+   thread.  */
 extern struct thread_info *any_thread_of_process (int pid);
 
-/* Returns any non-exited thread of process PID, giving preference for
-   not executing threads.  */
+/* Returns any non-exited thread of process PID, giving preference to
+   the current thread, and to not executing threads.  */
 extern struct thread_info *any_live_thread_of_process (int pid);
 
 /* Change the ptid of thread OLD_PTID to NEW_PTID.  */
@@ -312,10 +322,12 @@ void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid);
 typedef int (*thread_callback_func) (struct thread_info *, void *);
 extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
 
-/* Traverse all threads.  */
+/* Traverse all threads, except those that have THREAD_EXITED
+   state.  */
 
-#define ALL_THREADS(T)                         \
-  for (T = thread_list; T; T = T->next)
+#define ALL_NON_EXITED_THREADS(T)                              \
+  for (T = thread_list; T; T = T->next) \
+    if ((T)->state != THREAD_EXITED)
 
 extern int thread_count (void);
 
@@ -323,7 +335,7 @@ extern int thread_count (void);
 extern void switch_to_thread (ptid_t ptid);
 
 /* Marks thread PTID is running, or stopped. 
-   If PIDGET (PTID) is -1, marks all threads.  */
+   If ptid_get_pid (PTID) is -1, marks all threads.  */
 extern void set_running (ptid_t ptid, int running);
 
 /* Marks or clears thread(s) PTID as having been requested to stop.
@@ -358,10 +370,7 @@ extern int is_exited (ptid_t ptid);
 /* In the frontend's perpective, is this thread stopped?  */
 extern int is_stopped (ptid_t ptid);
 
-/* In the frontend's perpective is there any thread running?  */
-extern int any_running (void);
-
-/* Marks thread PTID as executing, or not.  If PIDGET (PTID) is -1,
+/* Marks thread PTID as executing, or not.  If ptid_get_pid (PTID) is -1,
    marks all threads.
 
    Note that this is different from the running state.  See the
@@ -372,6 +381,9 @@ extern void set_executing (ptid_t ptid, int executing);
 /* Reports if thread PTID is executing.  */
 extern int is_executing (ptid_t ptid);
 
+/* True if any (known or unknown) thread is or may be executing.  */
+extern int threads_are_executing (void);
+
 /* Merge the executing property of thread PTID over to its thread
    state property (frontend running/stopped view).
 
@@ -379,7 +391,7 @@ extern int is_executing (ptid_t ptid);
    "executing"     -> "running"
    "exited"        -> "exited"
 
-   If PIDGET (PTID) is -1, go over all threads.
+   If ptid_get_pid (PTID) is -1, go over all threads.
 
    Notifications are only emitted if the thread state did change.  */
 extern void finish_thread_state (ptid_t ptid);