xref: /dflybsd-src/contrib/gdb-7/gdb/gdbthread.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Multi-process/thread control defs for GDB, the GNU debugger.
2*ef5ccd6cSJohn Marino    Copyright (C) 1987-2013 Free Software Foundation, Inc.
35796c8dcSSimon Schubert    Contributed by Lynx Real-Time Systems, Inc.  Los Gatos, CA.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This file is part of GDB.
75796c8dcSSimon Schubert 
85796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
95796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
105796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
115796c8dcSSimon Schubert    (at your option) any later version.
125796c8dcSSimon Schubert 
135796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
145796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
155796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
165796c8dcSSimon Schubert    GNU General Public License for more details.
175796c8dcSSimon Schubert 
185796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
195796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
205796c8dcSSimon Schubert 
215796c8dcSSimon Schubert #ifndef GDBTHREAD_H
225796c8dcSSimon Schubert #define GDBTHREAD_H
235796c8dcSSimon Schubert 
245796c8dcSSimon Schubert struct symtab;
255796c8dcSSimon Schubert 
265796c8dcSSimon Schubert #include "breakpoint.h"
275796c8dcSSimon Schubert #include "frame.h"
285796c8dcSSimon Schubert #include "ui-out.h"
295796c8dcSSimon Schubert #include "inferior.h"
30*ef5ccd6cSJohn Marino #include "btrace.h"
315796c8dcSSimon Schubert 
32a45ae5f8SJohn Marino /* Frontend view of the thread state.  Possible extensions: stepping,
33a45ae5f8SJohn Marino    finishing, until(ling),...  */
34a45ae5f8SJohn Marino enum thread_state
35a45ae5f8SJohn Marino {
36a45ae5f8SJohn Marino   THREAD_STOPPED,
37a45ae5f8SJohn Marino   THREAD_RUNNING,
38a45ae5f8SJohn Marino   THREAD_EXITED,
39a45ae5f8SJohn Marino };
40a45ae5f8SJohn Marino 
41c50c785cSJohn Marino /* Inferior thread specific part of `struct infcall_control_state'.
42c50c785cSJohn Marino 
43c50c785cSJohn Marino    Inferior process counterpart is `struct inferior_control_state'.  */
44c50c785cSJohn Marino 
45c50c785cSJohn Marino struct thread_control_state
46c50c785cSJohn Marino {
47c50c785cSJohn Marino   /* User/external stepping state.  */
48c50c785cSJohn Marino 
49c50c785cSJohn Marino   /* Step-resume or longjmp-resume breakpoint.  */
50c50c785cSJohn Marino   struct breakpoint *step_resume_breakpoint;
51c50c785cSJohn Marino 
52c50c785cSJohn Marino   /* Exception-resume breakpoint.  */
53c50c785cSJohn Marino   struct breakpoint *exception_resume_breakpoint;
54c50c785cSJohn Marino 
55c50c785cSJohn Marino   /* Range to single step within.
56c50c785cSJohn Marino 
57c50c785cSJohn Marino      If this is nonzero, respond to a single-step signal by continuing
58c50c785cSJohn Marino      to step if the pc is in this range.
59c50c785cSJohn Marino 
60c50c785cSJohn Marino      If step_range_start and step_range_end are both 1, it means to
61c50c785cSJohn Marino      step for a single instruction (FIXME: it might clean up
62c50c785cSJohn Marino      wait_for_inferior in a minor way if this were changed to the
63c50c785cSJohn Marino      address of the instruction and that address plus one.  But maybe
64c50c785cSJohn Marino      not).  */
65c50c785cSJohn Marino   CORE_ADDR step_range_start;	/* Inclusive */
66c50c785cSJohn Marino   CORE_ADDR step_range_end;	/* Exclusive */
67c50c785cSJohn Marino 
68c50c785cSJohn Marino   /* Stack frame address as of when stepping command was issued.
69c50c785cSJohn Marino      This is how we know when we step into a subroutine call, and how
70c50c785cSJohn Marino      to set the frame for the breakpoint used to step out.  */
71c50c785cSJohn Marino   struct frame_id step_frame_id;
72c50c785cSJohn Marino 
73c50c785cSJohn Marino   /* Similarly, the frame ID of the underlying stack frame (skipping
74c50c785cSJohn Marino      any inlined frames).  */
75c50c785cSJohn Marino   struct frame_id step_stack_frame_id;
76c50c785cSJohn Marino 
77c50c785cSJohn Marino   /* Nonzero if we are presently stepping over a breakpoint.
78c50c785cSJohn Marino 
79c50c785cSJohn Marino      If we hit a breakpoint or watchpoint, and then continue, we need
80c50c785cSJohn Marino      to single step the current thread with breakpoints disabled, to
81c50c785cSJohn Marino      avoid hitting the same breakpoint or watchpoint again.  And we
82c50c785cSJohn Marino      should step just a single thread and keep other threads stopped,
83c50c785cSJohn Marino      so that other threads don't miss breakpoints while they are
84c50c785cSJohn Marino      removed.
85c50c785cSJohn Marino 
86c50c785cSJohn Marino      So, this variable simultaneously means that we need to single
87c50c785cSJohn Marino      step the current thread, keep other threads stopped, and that
88c50c785cSJohn Marino      breakpoints should be removed while we step.
89c50c785cSJohn Marino 
90c50c785cSJohn Marino      This variable is set either:
91c50c785cSJohn Marino      - in proceed, when we resume inferior on user's explicit request
92c50c785cSJohn Marino      - in keep_going, if handle_inferior_event decides we need to
93c50c785cSJohn Marino      step over breakpoint.
94c50c785cSJohn Marino 
95c50c785cSJohn Marino      The variable is cleared in normal_stop.  The proceed calls
96c50c785cSJohn Marino      wait_for_inferior, which calls handle_inferior_event in a loop,
97c50c785cSJohn Marino      and until wait_for_inferior exits, this variable is changed only
98c50c785cSJohn Marino      by keep_going.  */
99c50c785cSJohn Marino   int trap_expected;
100c50c785cSJohn Marino 
101c50c785cSJohn Marino   /* Nonzero if the thread is being proceeded for a "finish" command
102c50c785cSJohn Marino      or a similar situation when stop_registers should be saved.  */
103c50c785cSJohn Marino   int proceed_to_finish;
104c50c785cSJohn Marino 
105c50c785cSJohn Marino   /* Nonzero if the thread is being proceeded for an inferior function
106c50c785cSJohn Marino      call.  */
107c50c785cSJohn Marino   int in_infcall;
108c50c785cSJohn Marino 
109c50c785cSJohn Marino   enum step_over_calls_kind step_over_calls;
110c50c785cSJohn Marino 
111c50c785cSJohn Marino   /* Nonzero if stopped due to a step command.  */
112c50c785cSJohn Marino   int stop_step;
113c50c785cSJohn Marino 
114c50c785cSJohn Marino   /* Chain containing status of breakpoint(s) the thread stopped
115c50c785cSJohn Marino      at.  */
116c50c785cSJohn Marino   bpstat stop_bpstat;
117c50c785cSJohn Marino };
118c50c785cSJohn Marino 
119c50c785cSJohn Marino /* Inferior thread specific part of `struct infcall_suspend_state'.
120c50c785cSJohn Marino 
121c50c785cSJohn Marino    Inferior process counterpart is `struct inferior_suspend_state'.  */
122c50c785cSJohn Marino 
123c50c785cSJohn Marino struct thread_suspend_state
124c50c785cSJohn Marino {
125c50c785cSJohn Marino   /* Last signal that the inferior received (why it stopped).  */
126*ef5ccd6cSJohn Marino   enum gdb_signal stop_signal;
127c50c785cSJohn Marino };
128c50c785cSJohn Marino 
1295796c8dcSSimon Schubert struct thread_info
1305796c8dcSSimon Schubert {
1315796c8dcSSimon Schubert   struct thread_info *next;
1325796c8dcSSimon Schubert   ptid_t ptid;			/* "Actual process id";
1335796c8dcSSimon Schubert 				    In fact, this may be overloaded with
1345796c8dcSSimon Schubert 				    kernel thread id, etc.  */
1355796c8dcSSimon Schubert   int num;			/* Convenient handle (GDB thread id) */
1365796c8dcSSimon Schubert 
137c50c785cSJohn Marino   /* The name of the thread, as specified by the user.  This is NULL
138c50c785cSJohn Marino      if the thread does not have a user-given name.  */
139c50c785cSJohn Marino   char *name;
140c50c785cSJohn Marino 
1415796c8dcSSimon Schubert   /* Non-zero means the thread is executing.  Note: this is different
1425796c8dcSSimon Schubert      from saying that there is an active target and we are stopped at
1435796c8dcSSimon Schubert      a breakpoint, for instance.  This is a real indicator whether the
1445796c8dcSSimon Schubert      thread is off and running.  */
145a45ae5f8SJohn Marino   int executing;
1465796c8dcSSimon Schubert 
1475796c8dcSSimon Schubert   /* Frontend view of the thread state.  Note that the RUNNING/STOPPED
1485796c8dcSSimon Schubert      states are different from EXECUTING.  When the thread is stopped
1495796c8dcSSimon Schubert      internally while handling an internal event, like a software
1505796c8dcSSimon Schubert      single-step breakpoint, EXECUTING will be false, but running will
1515796c8dcSSimon Schubert      still be true.  As a possible future extension, this could turn
1525796c8dcSSimon Schubert      into enum { stopped, exited, stepping, finishing, until(ling),
1535796c8dcSSimon Schubert      running ... }  */
154a45ae5f8SJohn Marino   int state;
1555796c8dcSSimon Schubert 
1565796c8dcSSimon Schubert   /* If this is > 0, then it means there's code out there that relies
1575796c8dcSSimon Schubert      on this thread being listed.  Don't delete it from the lists even
1585796c8dcSSimon Schubert      if we detect it exiting.  */
1595796c8dcSSimon Schubert   int refcount;
1605796c8dcSSimon Schubert 
161c50c785cSJohn Marino   /* State of GDB control of inferior thread execution.
162c50c785cSJohn Marino      See `struct thread_control_state'.  */
163c50c785cSJohn Marino   struct thread_control_state control;
1645796c8dcSSimon Schubert 
165c50c785cSJohn Marino   /* State of inferior thread to restore after GDB is done with an inferior
166c50c785cSJohn Marino      call.  See `struct thread_suspend_state'.  */
167c50c785cSJohn Marino   struct thread_suspend_state suspend;
1685796c8dcSSimon Schubert 
1695796c8dcSSimon Schubert   int current_line;
1705796c8dcSSimon Schubert   struct symtab *current_symtab;
1715796c8dcSSimon Schubert 
1725796c8dcSSimon Schubert   /* Internal stepping state.  */
1735796c8dcSSimon Schubert 
1745796c8dcSSimon Schubert   /* Record the pc of the thread the last time it stopped.  This is
1755796c8dcSSimon Schubert      maintained by proceed and keep_going, and used in
1765796c8dcSSimon Schubert      adjust_pc_after_break to distinguish a hardware single-step
1775796c8dcSSimon Schubert      SIGTRAP from a breakpoint SIGTRAP.  */
1785796c8dcSSimon Schubert   CORE_ADDR prev_pc;
1795796c8dcSSimon Schubert 
1805796c8dcSSimon Schubert   /* Should we step over breakpoint next time keep_going is called?  */
1815796c8dcSSimon Schubert   int stepping_over_breakpoint;
1825796c8dcSSimon Schubert 
1835796c8dcSSimon Schubert   /* Set to TRUE if we should finish single-stepping over a breakpoint
184a45ae5f8SJohn Marino      after hitting the current step-resume breakpoint.  The context here
185a45ae5f8SJohn Marino      is that GDB is to do `next' or `step' while signal arrives.
186a45ae5f8SJohn Marino      When stepping over a breakpoint and signal arrives, GDB will attempt
187a45ae5f8SJohn Marino      to skip signal handler, so it inserts a step_resume_breakpoint at the
188a45ae5f8SJohn Marino      signal return address, and resume inferior.
189a45ae5f8SJohn Marino      step_after_step_resume_breakpoint is set to TRUE at this moment in
190a45ae5f8SJohn Marino      order to keep GDB in mind that there is still a breakpoint to step over
191a45ae5f8SJohn Marino      when GDB gets back SIGTRAP from step_resume_breakpoint.  */
1925796c8dcSSimon Schubert   int step_after_step_resume_breakpoint;
1935796c8dcSSimon Schubert 
1945796c8dcSSimon Schubert   /* Per-thread command support.  */
1955796c8dcSSimon Schubert 
1965796c8dcSSimon Schubert   /* Pointer to what is left to do for an execution command after the
1975796c8dcSSimon Schubert      target stops.  Used only in asynchronous mode, by targets that
1985796c8dcSSimon Schubert      support async execution.  Several execution commands use it.  */
1995796c8dcSSimon Schubert   struct continuation *continuations;
2005796c8dcSSimon Schubert 
2015796c8dcSSimon Schubert   /* Similar to the above, but used when a single execution command
2025796c8dcSSimon Schubert      requires several resume/stop iterations.  Used by the step
2035796c8dcSSimon Schubert      command.  */
2045796c8dcSSimon Schubert   struct continuation *intermediate_continuations;
2055796c8dcSSimon Schubert 
2065796c8dcSSimon Schubert   /* If stepping, nonzero means step count is > 1 so don't print frame
2075796c8dcSSimon Schubert      next time inferior stops if it stops due to stepping.  */
2085796c8dcSSimon Schubert   int step_multi;
2095796c8dcSSimon Schubert 
2105796c8dcSSimon Schubert   /* This is used to remember when a fork or vfork event was caught by
2115796c8dcSSimon Schubert      a catchpoint, and thus the event is to be followed at the next
2125796c8dcSSimon Schubert      resume of the thread, and not immediately.  */
2135796c8dcSSimon Schubert   struct target_waitstatus pending_follow;
2145796c8dcSSimon Schubert 
2155796c8dcSSimon Schubert   /* True if this thread has been explicitly requested to stop.  */
2165796c8dcSSimon Schubert   int stop_requested;
2175796c8dcSSimon Schubert 
218c50c785cSJohn Marino   /* The initiating frame of a nexting operation, used for deciding
219*ef5ccd6cSJohn Marino      which exceptions to intercept.  If it is null_frame_id no
220*ef5ccd6cSJohn Marino      bp_longjmp or bp_exception but longjmp has been caught just for
221*ef5ccd6cSJohn Marino      bp_longjmp_call_dummy.  */
222c50c785cSJohn Marino   struct frame_id initiating_frame;
223c50c785cSJohn Marino 
2245796c8dcSSimon Schubert   /* Private data used by the target vector implementation.  */
2255796c8dcSSimon Schubert   struct private_thread_info *private;
226cf7f2e2dSJohn Marino 
227cf7f2e2dSJohn Marino   /* Function that is called to free PRIVATE.  If this is NULL, then
228cf7f2e2dSJohn Marino      xfree will be called on PRIVATE.  */
229cf7f2e2dSJohn Marino   void (*private_dtor) (struct private_thread_info *);
230*ef5ccd6cSJohn Marino 
231*ef5ccd6cSJohn Marino   /* Branch trace information for this thread.  */
232*ef5ccd6cSJohn Marino   struct btrace_thread_info btrace;
2335796c8dcSSimon Schubert };
2345796c8dcSSimon Schubert 
2355796c8dcSSimon Schubert /* Create an empty thread list, or empty the existing one.  */
2365796c8dcSSimon Schubert extern void init_thread_list (void);
2375796c8dcSSimon Schubert 
2385796c8dcSSimon Schubert /* Add a thread to the thread list, print a message
2395796c8dcSSimon Schubert    that a new thread is found, and return the pointer to
2405796c8dcSSimon Schubert    the new thread.  Caller my use this pointer to
2415796c8dcSSimon Schubert    initialize the private thread data.  */
2425796c8dcSSimon Schubert extern struct thread_info *add_thread (ptid_t ptid);
2435796c8dcSSimon Schubert 
2445796c8dcSSimon Schubert /* Same as add_thread, but does not print a message
2455796c8dcSSimon Schubert    about new thread.  */
2465796c8dcSSimon Schubert extern struct thread_info *add_thread_silent (ptid_t ptid);
2475796c8dcSSimon Schubert 
2485796c8dcSSimon Schubert /* Same as add_thread, and sets the private info.  */
2495796c8dcSSimon Schubert extern struct thread_info *add_thread_with_info (ptid_t ptid,
2505796c8dcSSimon Schubert 						 struct private_thread_info *);
2515796c8dcSSimon Schubert 
2525796c8dcSSimon Schubert /* Delete an existing thread list entry.  */
2535796c8dcSSimon Schubert extern void delete_thread (ptid_t);
2545796c8dcSSimon Schubert 
2555796c8dcSSimon Schubert /* Delete an existing thread list entry, and be quiet about it.  Used
2565796c8dcSSimon Schubert    after the process this thread having belonged to having already
2575796c8dcSSimon Schubert    exited, for example.  */
2585796c8dcSSimon Schubert extern void delete_thread_silent (ptid_t);
2595796c8dcSSimon Schubert 
2605796c8dcSSimon Schubert /* Delete a step_resume_breakpoint from the thread database.  */
2615796c8dcSSimon Schubert extern void delete_step_resume_breakpoint (struct thread_info *);
2625796c8dcSSimon Schubert 
263c50c785cSJohn Marino /* Delete an exception_resume_breakpoint from the thread database.  */
264c50c785cSJohn Marino extern void delete_exception_resume_breakpoint (struct thread_info *);
265c50c785cSJohn Marino 
2665796c8dcSSimon Schubert /* Translate the integer thread id (GDB's homegrown id, not the system's)
2675796c8dcSSimon Schubert    into a "pid" (which may be overloaded with extra thread information).  */
2685796c8dcSSimon Schubert extern ptid_t thread_id_to_pid (int);
2695796c8dcSSimon Schubert 
2705796c8dcSSimon Schubert /* Translate a 'pid' (which may be overloaded with extra thread information)
2715796c8dcSSimon Schubert    into the integer thread id (GDB's homegrown id, not the system's).  */
2725796c8dcSSimon Schubert extern int pid_to_thread_id (ptid_t ptid);
2735796c8dcSSimon Schubert 
2745796c8dcSSimon Schubert /* Boolean test for an already-known pid (which may be overloaded with
2755796c8dcSSimon Schubert    extra thread information).  */
2765796c8dcSSimon Schubert extern int in_thread_list (ptid_t ptid);
2775796c8dcSSimon Schubert 
2785796c8dcSSimon Schubert /* Boolean test for an already-known thread id (GDB's homegrown id,
2795796c8dcSSimon Schubert    not the system's).  */
2805796c8dcSSimon Schubert extern int valid_thread_id (int thread);
2815796c8dcSSimon Schubert 
2825796c8dcSSimon Schubert /* Search function to lookup a thread by 'pid'.  */
2835796c8dcSSimon Schubert extern struct thread_info *find_thread_ptid (ptid_t ptid);
2845796c8dcSSimon Schubert 
2855796c8dcSSimon Schubert /* Find thread by GDB user-visible thread number.  */
2865796c8dcSSimon Schubert struct thread_info *find_thread_id (int num);
2875796c8dcSSimon Schubert 
2885796c8dcSSimon Schubert /* Finds the first thread of the inferior given by PID.  If PID is -1,
2895796c8dcSSimon Schubert    returns the first thread in the list.  */
2905796c8dcSSimon Schubert struct thread_info *first_thread_of_process (int pid);
2915796c8dcSSimon Schubert 
2925796c8dcSSimon Schubert /* Returns any thread of process PID.  */
2935796c8dcSSimon Schubert extern struct thread_info *any_thread_of_process (int pid);
2945796c8dcSSimon Schubert 
295cf7f2e2dSJohn Marino /* Returns any non-exited thread of process PID, giving preference for
296c50c785cSJohn Marino    not executing threads.  */
297cf7f2e2dSJohn Marino extern struct thread_info *any_live_thread_of_process (int pid);
298cf7f2e2dSJohn Marino 
2995796c8dcSSimon Schubert /* Change the ptid of thread OLD_PTID to NEW_PTID.  */
3005796c8dcSSimon Schubert void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid);
3015796c8dcSSimon Schubert 
3025796c8dcSSimon Schubert /* Iterator function to call a user-provided callback function
3035796c8dcSSimon Schubert    once for each known thread.  */
3045796c8dcSSimon Schubert typedef int (*thread_callback_func) (struct thread_info *, void *);
3055796c8dcSSimon Schubert extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
3065796c8dcSSimon Schubert 
307*ef5ccd6cSJohn Marino /* Traverse all threads.  */
308*ef5ccd6cSJohn Marino 
309*ef5ccd6cSJohn Marino #define ALL_THREADS(T)				\
310*ef5ccd6cSJohn Marino   for (T = thread_list; T; T = T->next)
311*ef5ccd6cSJohn Marino 
3125796c8dcSSimon Schubert extern int thread_count (void);
3135796c8dcSSimon Schubert 
3145796c8dcSSimon Schubert /* Switch from one thread to another.  */
3155796c8dcSSimon Schubert extern void switch_to_thread (ptid_t ptid);
3165796c8dcSSimon Schubert 
3175796c8dcSSimon Schubert /* Marks thread PTID is running, or stopped.
3185796c8dcSSimon Schubert    If PIDGET (PTID) is -1, marks all threads.  */
3195796c8dcSSimon Schubert extern void set_running (ptid_t ptid, int running);
3205796c8dcSSimon Schubert 
3215796c8dcSSimon Schubert /* Marks or clears thread(s) PTID as having been requested to stop.
3225796c8dcSSimon Schubert    If PTID is MINUS_ONE_PTID, applies to all threads.  If
3235796c8dcSSimon Schubert    ptid_is_pid(PTID) is true, applies to all threads of the process
3245796c8dcSSimon Schubert    pointed at by PTID.  If STOP, then the THREAD_STOP_REQUESTED
3255796c8dcSSimon Schubert    observer is called with PTID as argument.  */
3265796c8dcSSimon Schubert extern void set_stop_requested (ptid_t ptid, int stop);
3275796c8dcSSimon Schubert 
3285796c8dcSSimon Schubert /* NOTE: Since the thread state is not a boolean, most times, you do
3295796c8dcSSimon Schubert    not want to check it with negation.  If you really want to check if
3305796c8dcSSimon Schubert    the thread is stopped,
3315796c8dcSSimon Schubert 
3325796c8dcSSimon Schubert     use (good):
3335796c8dcSSimon Schubert 
3345796c8dcSSimon Schubert      if (is_stopped (ptid))
3355796c8dcSSimon Schubert 
3365796c8dcSSimon Schubert     instead of (bad):
3375796c8dcSSimon Schubert 
3385796c8dcSSimon Schubert      if (!is_running (ptid))
3395796c8dcSSimon Schubert 
3405796c8dcSSimon Schubert    The latter also returns true on exited threads, most likelly not
3415796c8dcSSimon Schubert    what you want.  */
3425796c8dcSSimon Schubert 
3435796c8dcSSimon Schubert /* Reports if in the frontend's perpective, thread PTID is running.  */
3445796c8dcSSimon Schubert extern int is_running (ptid_t ptid);
3455796c8dcSSimon Schubert 
3465796c8dcSSimon Schubert /* Is this thread listed, but known to have exited?  We keep it listed
3475796c8dcSSimon Schubert    (but not visible) until it's safe to delete.  */
3485796c8dcSSimon Schubert extern int is_exited (ptid_t ptid);
3495796c8dcSSimon Schubert 
3505796c8dcSSimon Schubert /* In the frontend's perpective, is this thread stopped?  */
3515796c8dcSSimon Schubert extern int is_stopped (ptid_t ptid);
3525796c8dcSSimon Schubert 
3535796c8dcSSimon Schubert /* In the frontend's perpective is there any thread running?  */
3545796c8dcSSimon Schubert extern int any_running (void);
3555796c8dcSSimon Schubert 
3565796c8dcSSimon Schubert /* Marks thread PTID as executing, or not.  If PIDGET (PTID) is -1,
3575796c8dcSSimon Schubert    marks all threads.
3585796c8dcSSimon Schubert 
3595796c8dcSSimon Schubert    Note that this is different from the running state.  See the
360a45ae5f8SJohn Marino    description of state and executing fields of struct
3615796c8dcSSimon Schubert    thread_info.  */
3625796c8dcSSimon Schubert extern void set_executing (ptid_t ptid, int executing);
3635796c8dcSSimon Schubert 
3645796c8dcSSimon Schubert /* Reports if thread PTID is executing.  */
3655796c8dcSSimon Schubert extern int is_executing (ptid_t ptid);
3665796c8dcSSimon Schubert 
3675796c8dcSSimon Schubert /* Merge the executing property of thread PTID over to its thread
3685796c8dcSSimon Schubert    state property (frontend running/stopped view).
3695796c8dcSSimon Schubert 
3705796c8dcSSimon Schubert    "not executing" -> "stopped"
3715796c8dcSSimon Schubert    "executing"     -> "running"
3725796c8dcSSimon Schubert    "exited"        -> "exited"
3735796c8dcSSimon Schubert 
3745796c8dcSSimon Schubert    If PIDGET (PTID) is -1, go over all threads.
3755796c8dcSSimon Schubert 
3765796c8dcSSimon Schubert    Notifications are only emitted if the thread state did change.  */
3775796c8dcSSimon Schubert extern void finish_thread_state (ptid_t ptid);
3785796c8dcSSimon Schubert 
3795796c8dcSSimon Schubert /* Same as FINISH_THREAD_STATE, but with an interface suitable to be
3805796c8dcSSimon Schubert    registered as a cleanup.  PTID_P points to the ptid_t that is
3815796c8dcSSimon Schubert    passed to FINISH_THREAD_STATE.  */
3825796c8dcSSimon Schubert extern void finish_thread_state_cleanup (void *ptid_p);
3835796c8dcSSimon Schubert 
3845796c8dcSSimon Schubert /* Commands with a prefix of `thread'.  */
3855796c8dcSSimon Schubert extern struct cmd_list_element *thread_cmd_list;
3865796c8dcSSimon Schubert 
3875796c8dcSSimon Schubert /* Print notices on thread events (attach, detach, etc.), set with
3885796c8dcSSimon Schubert    `set print thread-events'.  */
3895796c8dcSSimon Schubert extern int print_thread_events;
3905796c8dcSSimon Schubert 
391c50c785cSJohn Marino extern void print_thread_info (struct ui_out *uiout, char *threads,
3925796c8dcSSimon Schubert 			       int pid);
3935796c8dcSSimon Schubert 
3945796c8dcSSimon Schubert extern struct cleanup *make_cleanup_restore_current_thread (void);
3955796c8dcSSimon Schubert 
3965796c8dcSSimon Schubert /* Returns a pointer into the thread_info corresponding to
3975796c8dcSSimon Schubert    INFERIOR_PTID.  INFERIOR_PTID *must* be in the thread list.  */
3985796c8dcSSimon Schubert extern struct thread_info* inferior_thread (void);
3995796c8dcSSimon Schubert 
400cf7f2e2dSJohn Marino extern void update_thread_list (void);
401cf7f2e2dSJohn Marino 
402*ef5ccd6cSJohn Marino extern struct thread_info *thread_list;
403*ef5ccd6cSJohn Marino 
4045796c8dcSSimon Schubert #endif /* GDBTHREAD_H */
405