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