diff options
Diffstat (limited to 'include/lldb/Target/Thread.h')
-rw-r--r-- | include/lldb/Target/Thread.h | 164 |
1 files changed, 95 insertions, 69 deletions
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index c6a3c8e9851a..7aff77bd16f4 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -10,6 +10,14 @@ #ifndef liblldb_Thread_h_ #define liblldb_Thread_h_ +// C Includes +// C++ Includes +#include <memory> +#include <string> +#include <vector> + +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Host/Mutex.h" #include "lldb/Core/Broadcaster.h" @@ -30,8 +38,7 @@ class ThreadProperties : public Properties public: ThreadProperties(bool is_global); - virtual - ~ThreadProperties(); + ~ThreadProperties() override; //------------------------------------------------------------------ /// The regular expression returned determines symbols that this @@ -39,7 +46,7 @@ public: /// /// @return /// A pointer to a regular expression to compare against symbols, - /// or NULL if all symbols are allowed. + /// or nullptr if all symbols are allowed. /// //------------------------------------------------------------------ const RegularExpression * @@ -82,7 +89,7 @@ public: static ConstString &GetStaticBroadcasterClass (); - virtual ConstString &GetBroadcasterClass() const + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } @@ -97,19 +104,19 @@ public: ThreadEventData(); - virtual ~ThreadEventData(); + ~ThreadEventData() override; static const ConstString & GetFlavorString (); - virtual const ConstString & - GetFlavor () const + const ConstString & + GetFlavor() const override { return ThreadEventData::GetFlavorString (); } - virtual void - Dump (Stream *s) const; + void + Dump(Stream *s) const override; static const ThreadEventData * GetEventDataFromEvent (const Event *event_ptr); @@ -138,9 +145,9 @@ public: private: lldb::ThreadSP m_thread_sp; StackID m_stack_id; - DISALLOW_COPY_AND_ASSIGN (ThreadEventData); + + DISALLOW_COPY_AND_ASSIGN (ThreadEventData); }; - struct ThreadStateCheckpoint { @@ -151,15 +158,6 @@ public: lldb::addr_t current_inlined_pc; }; - static void - SettingsInitialize (); - - static void - SettingsTerminate (); - - static const ThreadPropertiesSP & - GetGlobalProperties(); - //------------------------------------------------------------------ /// Constructor /// @@ -179,7 +177,16 @@ public: //------------------------------------------------------------------ Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id = false); - virtual ~Thread(); + ~Thread() override; + + static void + SettingsInitialize (); + + static void + SettingsTerminate (); + + static const ThreadPropertiesSP & + GetGlobalProperties(); lldb::ProcessSP GetProcess() const @@ -303,6 +310,9 @@ public: lldb::StopReason GetStopReason(); + bool + StopInfoIsUpToDate() const; + // This sets the stop reason to a "blank" stop reason, so you can call functions on the thread // without having the called function run with whatever stop reason you stopped with. void @@ -320,7 +330,7 @@ public: virtual const char * GetInfo () { - return NULL; + return nullptr; } //------------------------------------------------------------------ @@ -348,7 +358,7 @@ public: virtual const char * GetName () { - return NULL; + return nullptr; } virtual void @@ -390,12 +400,12 @@ public: /// /// @return /// The Queue name, if the Thread subclass implements this, else - /// NULL. + /// nullptr. //------------------------------------------------------------------ virtual const char * GetQueueName () { - return NULL; + return nullptr; } virtual void @@ -475,7 +485,7 @@ public: ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast = false); Error - JumpToLine (const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = NULL); + JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = nullptr); virtual lldb::StackFrameSP GetFrameWithStackID (const StackID &stack_id) @@ -492,16 +502,11 @@ public: } lldb::StackFrameSP - GetSelectedFrame () - { - lldb::StackFrameListSP stack_frame_list_sp(GetStackFrameList()); - return stack_frame_list_sp->GetFrameAtIndex (stack_frame_list_sp->GetSelectedFrameIndex()); - } + GetSelectedFrame (); uint32_t SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast = false); - bool SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast = false); @@ -608,6 +613,7 @@ public: //------------------------------------------------------------------ virtual Error StepOut (); + //------------------------------------------------------------------ /// Retrieves the per-thread data area. /// Most OSs maintain a per-thread pointer (e.g. the FS register on @@ -684,7 +690,7 @@ public: /// Otherwise this plan will go on the end of the plan stack. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueFundamentalPlan (bool abort_other_plans); @@ -703,7 +709,7 @@ public: /// \b true if we will stop other threads while we single step this one. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction (bool step_over, @@ -739,7 +745,7 @@ public: /// If eLazyBoolCalculate, we will consult the default set in the thread. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange (bool abort_other_plans, @@ -748,6 +754,15 @@ public: lldb::RunMode stop_other_threads, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); + // Helper function that takes a LineEntry to step, insted of an AddressRange. This may combine multiple + // LineEntries of the same source line number to step over a longer address range in a single operation. + virtual lldb::ThreadPlanSP + QueueThreadPlanForStepOverRange (bool abort_other_plans, + const LineEntry &line_entry, + const SymbolContext &addr_context, + lldb::RunMode stop_other_threads, + LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); + //------------------------------------------------------------------ /// Queues the plan used to step through an address range, stepping into functions. /// @@ -783,7 +798,7 @@ public: /// If eLazyBoolCalculate, it will consult the default set in the thread. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange (bool abort_other_plans, @@ -794,6 +809,17 @@ public: LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); + // Helper function that takes a LineEntry to step, insted of an AddressRange. This may combine multiple + // LineEntries of the same source line number to step over a longer address range in a single operation. + virtual lldb::ThreadPlanSP + QueueThreadPlanForStepInRange (bool abort_other_plans, + const LineEntry &line_entry, + const SymbolContext &addr_context, + const char *step_in_target, + lldb::RunMode stop_other_threads, + LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, + LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); + //------------------------------------------------------------------ /// Queue the plan used to step out of the function at the current PC of /// \a thread. @@ -824,7 +850,7 @@ public: /// If eLazyBoolCalculate, it will consult the default set in the thread. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut (bool abort_other_plans, @@ -863,7 +889,7 @@ public: /// See standard meanings for the stop & run votes in ThreadPlan.h. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop (bool abort_other_plans, @@ -891,7 +917,7 @@ public: /// \b true if we will stop other threads while we single step this one. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepThrough (StackID &return_stack_id, @@ -914,7 +940,7 @@ public: /// \b true if we will stop other threads while we single step this one. /// /// @return - /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued. + /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForRunToAddress (bool abort_other_plans, @@ -957,15 +983,6 @@ public: Error UnwindInnermostExpression(); -private: - bool - PlanIsBasePlan (ThreadPlan *plan_ptr); - - void - BroadcastSelectedFrameChange(StackID &new_frame_id); - -public: - //------------------------------------------------------------------ /// Gets the outer-most plan that was popped off the plan stack in the /// most recent stop. Useful for printing the stop reason accurately. @@ -990,11 +1007,11 @@ public: /// Gets the outer-most expression variable from the completed plans /// /// @return - /// A ClangExpressionVariableSP, either empty if there is no + /// A ExpressionVariableSP, either empty if there is no /// plan completed an expression during the current stop /// or the expression variable that was made for the completed expression. //------------------------------------------------------------------ - lldb::ClangExpressionVariableSP + lldb::ExpressionVariableSP GetExpressionVariable (); //------------------------------------------------------------------ @@ -1041,7 +1058,6 @@ public: void QueueThreadPlan (lldb::ThreadPlanSP &plan_sp, bool abort_other_plans); - //------------------------------------------------------------------ /// Discards the plans queued on the plan stack of the current thread. This is /// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call. @@ -1147,20 +1163,20 @@ public: //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions //------------------------------------------------------------------ - virtual lldb::TargetSP - CalculateTarget (); + lldb::TargetSP + CalculateTarget() override; - virtual lldb::ProcessSP - CalculateProcess (); + lldb::ProcessSP + CalculateProcess() override; - virtual lldb::ThreadSP - CalculateThread (); + lldb::ThreadSP + CalculateThread() override; - virtual lldb::StackFrameSP - CalculateStackFrame (); + lldb::StackFrameSP + CalculateStackFrame() override; - virtual void - CalculateExecutionContext (ExecutionContext &exe_ctx); + void + CalculateExecutionContext(ExecutionContext &exe_ctx) override; lldb::StackFrameSP GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr); @@ -1271,7 +1287,6 @@ public: } protected: - friend class ThreadPlan; friend class ThreadList; friend class ThreadEventData; @@ -1323,7 +1338,15 @@ protected: lldb::StackFrameListSP GetStackFrameList (); - + + void + SetTemporaryResumeState(lldb::StateType new_state) + { + m_temporary_resume_state = new_state; + } + + void + FunctionOptimizationWarning (lldb_private::StackFrame *frame); //------------------------------------------------------------------ // Classes that inherit from Process can see and modify these @@ -1353,14 +1376,17 @@ protected: private: bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info for this thread? StructuredData::ObjectSP m_extended_info; // The extended info for this thread - //------------------------------------------------------------------ - // For Thread only - //------------------------------------------------------------------ - DISALLOW_COPY_AND_ASSIGN (Thread); +private: + bool + PlanIsBasePlan (ThreadPlan *plan_ptr); + void + BroadcastSelectedFrameChange(StackID &new_frame_id); + + DISALLOW_COPY_AND_ASSIGN (Thread); }; } // namespace lldb_private -#endif // liblldb_Thread_h_ +#endif // liblldb_Thread_h_ |