diff options
Diffstat (limited to 'gdb/gdbthread.h')
-rw-r--r-- | gdb/gdbthread.h | 131 |
1 files changed, 56 insertions, 75 deletions
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index c0f27a8..10ec04c 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -84,11 +84,11 @@ enum thread_state STEP_OVER_NONE means don't step over any subroutine calls. */ enum step_over_calls_kind - { - STEP_OVER_NONE, - STEP_OVER_ALL, - STEP_OVER_UNDEBUGGABLE - }; +{ + STEP_OVER_NONE, + STEP_OVER_ALL, + STEP_OVER_UNDEBUGGABLE +}; /* Inferior thread specific part of `struct infcall_control_state'. @@ -121,8 +121,8 @@ struct thread_control_state wait_for_inferior in a minor way if this were changed to the address of the instruction and that address plus one. But maybe not). */ - CORE_ADDR step_range_start = 0; /* Inclusive */ - CORE_ADDR step_range_end = 0; /* Exclusive */ + CORE_ADDR step_range_start = 0; /* Inclusive */ + CORE_ADDR step_range_end = 0; /* Exclusive */ /* Function the thread was in as of last it started stepping. */ struct symbol *step_start_function = nullptr; @@ -138,11 +138,15 @@ struct thread_control_state /* Stack frame address as of when stepping command was issued. This is how we know when we step into a subroutine call, and how to set the frame for the breakpoint used to step out. */ - struct frame_id step_frame_id {}; + struct frame_id step_frame_id + { + }; /* Similarly, the frame ID of the underlying stack frame (skipping any inlined frames). */ - struct frame_id step_stack_frame_id {}; + struct frame_id step_stack_frame_id + { + }; /* True if the the thread is presently stepping over a breakpoint or a watchpoint, either with an inline step over or a displaced (out @@ -245,6 +249,7 @@ class thread_info : public refcounted_object, public intrusive_list_node<thread_info> { public: + explicit thread_info (inferior *inf, ptid_t ptid); ~thread_info (); @@ -253,7 +258,7 @@ public: /* Mark this thread as running and notify observers. */ void set_running (bool running); - ptid_t ptid; /* "Actual process id"; + ptid_t ptid; /* "Actual process id"; In fact, this may be overloaded with kernel thread id, etc. */ @@ -300,10 +305,7 @@ public: /* The user-given name of the thread. Returns nullptr if the thread does not have a user-given name. */ - const char *name () const - { - return m_name.get (); - } + const char *name () const { return m_name.get (); } /* Set the user-given name of the thread. @@ -313,15 +315,13 @@ public: m_name = std::move (name); } - bool executing () const - { return m_executing; } + bool executing () const { return m_executing; } /* Set the thread's 'm_executing' field from EXECUTING, and if EXECUTING is true also clears the thread's stop_pc. */ void set_executing (bool executing); - bool resumed () const - { return m_resumed; } + bool resumed () const { return m_resumed; } /* Set the thread's 'm_resumed' field from RESUMED. The thread may also be added to (when RESUMED is true), or removed from (when RESUMED is @@ -366,25 +366,16 @@ public: /* Set this thread's stop PC. */ - void set_stop_pc (CORE_ADDR stop_pc) - { - m_suspend.stop_pc = stop_pc; - } + void set_stop_pc (CORE_ADDR stop_pc) { m_suspend.stop_pc = stop_pc; } /* Remove the stop_pc stored on this thread. */ - void clear_stop_pc () - { - m_suspend.stop_pc.reset (); - } + void clear_stop_pc () { m_suspend.stop_pc.reset (); } /* Return true if this thread has a cached stop pc value, otherwise return false. */ - bool stop_pc_p () const - { - return m_suspend.stop_pc.has_value (); - } + bool stop_pc_p () const { return m_suspend.stop_pc.has_value (); } /* Return true if this thread has a pending wait status. */ @@ -418,24 +409,15 @@ public: /* Return this thread's stop signal. */ - gdb_signal stop_signal () const - { - return m_suspend.stop_signal; - } + gdb_signal stop_signal () const { return m_suspend.stop_signal; } /* Set this thread's stop signal. */ - void set_stop_signal (gdb_signal sig) - { - m_suspend.stop_signal = sig; - } + void set_stop_signal (gdb_signal sig) { m_suspend.stop_signal = sig; } /* Return this thread's stop reason. */ - target_stop_reason stop_reason () const - { - return m_suspend.stop_reason; - } + target_stop_reason stop_reason () const { return m_suspend.stop_reason; } /* Set this thread's stop reason. */ @@ -446,10 +428,7 @@ public: /* Get the FSM associated with the thread. */ - struct thread_fsm *thread_fsm () const - { - return m_thread_fsm.get (); - } + struct thread_fsm *thread_fsm () const { return m_thread_fsm.get (); } /* Get the owning reference to the FSM associated with the thread. @@ -525,7 +504,9 @@ public: std::unique_ptr<private_thread_info> priv; /* Branch trace information for this thread. */ - struct btrace_thread_info btrace {}; + struct btrace_thread_info btrace + { + }; /* Flag which indicates that the stack temporaries should be stored while evaluating expressions. */ @@ -549,6 +530,7 @@ public: displaced_step_thread_state displaced_step_state; private: + /* True if this thread is resumed from infrun's perspective. Note that a thread can be marked both as not-executing and resumed at the same time. This happens if we try to resume a @@ -679,8 +661,9 @@ extern struct thread_info *find_thread_ptid (process_stratum_target *targ, struct thread_info *find_thread_global_id (int global_id); /* Find thread by thread library specific handle in inferior INF. */ -struct thread_info *find_thread_by_handle - (gdb::array_view<const gdb_byte> handle, struct inferior *inf); +struct thread_info * +find_thread_by_handle (gdb::array_view<const gdb_byte> handle, + struct inferior *inf); /* Finds the first thread of the specified inferior. */ extern struct thread_info *first_thread_of_inferior (inferior *inf); @@ -694,8 +677,8 @@ extern struct thread_info *any_thread_of_inferior (inferior *inf); extern struct thread_info *any_live_thread_of_inferior (inferior *inf); /* Change the ptid of thread OLD_PTID to NEW_PTID. */ -void thread_change_ptid (process_stratum_target *targ, - ptid_t old_ptid, ptid_t new_ptid); +void thread_change_ptid (process_stratum_target *targ, ptid_t old_ptid, + ptid_t new_ptid); /* Iterator function to call a user-provided callback function once for each known thread. */ @@ -780,21 +763,21 @@ extern void switch_to_thread_no_regs (struct thread_info *thread); MINUS_ONE_PTID, applies to all threads of TARG. If ptid_is_pid(PTID) is true, applies to all threads of the process pointed at by {TARG,PTID}. */ -extern void set_resumed (process_stratum_target *targ, - ptid_t ptid, bool resumed); +extern void set_resumed (process_stratum_target *targ, ptid_t ptid, + bool resumed); /* Marks thread PTID of TARG as running, or as stopped. If PTID is minus_one_ptid, marks all threads of TARG. */ -extern void set_running (process_stratum_target *targ, - ptid_t ptid, bool running); +extern void set_running (process_stratum_target *targ, ptid_t ptid, + bool running); /* Marks or clears thread(s) PTID of TARG as having been requested to stop. If PTID is MINUS_ONE_PTID, applies to all threads of TARG. If ptid_is_pid(PTID) is true, applies to all threads of the process pointed at by {TARG, PTID}. If STOP, then the THREAD_STOP_REQUESTED observer is called with PTID as argument. */ -extern void set_stop_requested (process_stratum_target *targ, - ptid_t ptid, bool stop); +extern void set_stop_requested (process_stratum_target *targ, ptid_t ptid, + bool stop); /* Marks thread PTID of TARG as executing, or not. If PTID is minus_one_ptid, marks all threads of TARG. @@ -802,8 +785,8 @@ extern void set_stop_requested (process_stratum_target *targ, Note that this is different from the running state. See the description of state and executing fields of struct thread_info. */ -extern void set_executing (process_stratum_target *targ, - ptid_t ptid, bool executing); +extern void set_executing (process_stratum_target *targ, ptid_t ptid, + bool executing); /* True if any (known or unknown) thread of TARG is or may be executing. */ @@ -823,8 +806,7 @@ extern void finish_thread_state (process_stratum_target *targ, ptid_t ptid); /* Calls finish_thread_state on scope exit, unless release() is called to disengage. */ -using scoped_finish_thread_state - = FORWARD_SCOPE_EXIT (finish_thread_state); +using scoped_finish_thread_state = FORWARD_SCOPE_EXIT (finish_thread_state); /* Commands with a prefix of `thread'. */ extern struct cmd_list_element *thread_cmd_list; @@ -843,14 +825,14 @@ extern bool print_thread_events; NULL and PID is not -1, then the thread is printed if it belongs to the specified process. Otherwise, an error is raised. */ extern void print_thread_info (struct ui_out *uiout, - const char *requested_threads, - int pid); + const char *requested_threads, int pid); /* Save/restore current inferior/thread/frame. */ class scoped_restore_current_thread { public: + scoped_restore_current_thread (); ~scoped_restore_current_thread (); @@ -860,6 +842,7 @@ public: void dont_restore () { m_dont_restore = true; } private: + void restore (); bool m_dont_restore = false; @@ -877,7 +860,7 @@ private: /* Returns a pointer into the thread_info corresponding to INFERIOR_PTID. INFERIOR_PTID *must* be in the thread list. */ -extern struct thread_info* inferior_thread (void); +extern struct thread_info *inferior_thread (void); extern void update_thread_list (void); @@ -924,7 +907,8 @@ private: extern bool thread_stack_temporaries_enabled_p (struct thread_info *tp); -extern void push_thread_stack_temporary (struct thread_info *tp, struct value *v); +extern void push_thread_stack_temporary (struct thread_info *tp, + struct value *v); extern value *get_last_thread_stack_temporary (struct thread_info *tp); @@ -946,11 +930,9 @@ using thread_step_over_list_safe_range static inline thread_step_over_list_safe_range make_thread_step_over_list_safe_range (thread_step_over_list &list) { - return thread_step_over_list_safe_range - (thread_step_over_list_safe_iterator (list.begin (), - list.end ()), - thread_step_over_list_safe_iterator (list.end (), - list.end ())); + return thread_step_over_list_safe_range ( + thread_step_over_list_safe_iterator (list.begin (), list.end ()), + thread_step_over_list_safe_iterator (list.end (), list.end ())); } /* Add TP to the end of the global pending step-over chain. */ @@ -960,8 +942,8 @@ extern void global_thread_step_over_chain_enqueue (thread_info *tp); /* Append the thread step over list LIST to the global thread step over chain. */ -extern void global_thread_step_over_chain_enqueue_chain - (thread_step_over_list &&list); +extern void +global_thread_step_over_chain_enqueue_chain (thread_step_over_list &&list); /* Remove TP from the global pending step-over chain. */ @@ -1026,9 +1008,8 @@ extern bool switch_to_thread_if_alive (thread_info *thr); exception if !FLAGS.SILENT and !FLAGS.CONT and CMD fails. */ extern void thread_try_catch_cmd (thread_info *thr, - gdb::optional<int> ada_task, - const char *cmd, int from_tty, - const qcs_flags &flags); + gdb::optional<int> ada_task, const char *cmd, + int from_tty, const qcs_flags &flags); /* Return a string representation of STATE. */ |