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