1 //===-- SBThreadPlan.h ------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_API_SBTHREADPLAN_H 10 #define LLDB_API_SBTHREADPLAN_H 11 12 #include "lldb/API/SBDefines.h" 13 14 #include <cstdio> 15 16 namespace lldb { 17 18 class LLDB_API SBThreadPlan { 19 20 public: 21 SBThreadPlan(); 22 23 SBThreadPlan(const lldb::SBThreadPlan &threadPlan); 24 25 SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp); 26 27 SBThreadPlan(lldb::SBThread &thread, const char *class_name); 28 29 SBThreadPlan(lldb::SBThread &thread, const char *class_name, 30 lldb::SBStructuredData &args_data); 31 32 ~SBThreadPlan(); 33 34 explicit operator bool() const; 35 36 bool IsValid() const; 37 38 void Clear(); 39 40 lldb::StopReason GetStopReason(); 41 42 /// Get the number of words associated with the stop reason. 43 /// See also GetStopReasonDataAtIndex(). 44 size_t GetStopReasonDataCount(); 45 46 /// Get information associated with a stop reason. 47 /// 48 /// Breakpoint stop reasons will have data that consists of pairs of 49 /// breakpoint IDs followed by the breakpoint location IDs (they always come 50 /// in pairs). 51 /// 52 /// Stop Reason Count Data Type 53 /// ======================== ===== ========================================= 54 /// eStopReasonNone 0 55 /// eStopReasonTrace 0 56 /// eStopReasonBreakpoint N duple: {breakpoint id, location id} 57 /// eStopReasonWatchpoint 1 watchpoint id 58 /// eStopReasonSignal 1 unix signal number 59 /// eStopReasonException N exception data 60 /// eStopReasonExec 0 61 /// eStopReasonFork 1 pid of the child process 62 /// eStopReasonVFork 1 pid of the child process 63 /// eStopReasonVForkDone 0 64 /// eStopReasonPlanComplete 0 65 uint64_t GetStopReasonDataAtIndex(uint32_t idx); 66 67 SBThread GetThread() const; 68 69 const lldb::SBThreadPlan &operator=(const lldb::SBThreadPlan &rhs); 70 71 bool GetDescription(lldb::SBStream &description) const; 72 73 void SetPlanComplete(bool success); 74 75 bool IsPlanComplete(); 76 77 bool IsPlanStale(); 78 79 bool IsValid(); 80 81 bool GetStopOthers(); 82 83 void SetStopOthers(bool stop_others); 84 85 // This section allows an SBThreadPlan to push another of the common types of 86 // plans... 87 SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address, 88 lldb::addr_t range_size); 89 SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address, 90 lldb::addr_t range_size, 91 SBError &error); 92 93 SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address, 94 lldb::addr_t range_size); 95 SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address, 96 lldb::addr_t range_size, 97 SBError &error); 98 99 SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to, 100 bool first_insn = false); 101 SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to, 102 bool first_insn, SBError &error); 103 104 SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address); 105 SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address, 106 SBError &error); 107 108 SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name); 109 SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, 110 SBError &error); 111 SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, 112 lldb::SBStructuredData &args_data, 113 SBError &error); 114 115 private: 116 friend class SBBreakpoint; 117 friend class SBBreakpointLocation; 118 friend class SBFrame; 119 friend class SBProcess; 120 friend class SBDebugger; 121 friend class SBValue; 122 friend class lldb_private::QueueImpl; 123 friend class SBQueueItem; 124 125 lldb::ThreadPlanSP GetSP() const { return m_opaque_wp.lock(); } 126 lldb_private::ThreadPlan *get() const { return GetSP().get(); } 127 void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp); 128 129 lldb::ThreadPlanWP m_opaque_wp; 130 }; 131 132 } // namespace lldb 133 134 #endif // LLDB_API_SBTHREADPLAN_H 135