• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <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   bool GetStopOthers();
81 
82   void SetStopOthers(bool stop_others);
83 
84   // This section allows an SBThreadPlan to push another of the common types of
85   // plans...
86   SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
87                                                lldb::addr_t range_size);
88   SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
89                                                lldb::addr_t range_size,
90                                                SBError &error);
91 
92   SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
93                                              lldb::addr_t range_size);
94   SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
95                                              lldb::addr_t range_size,
96                                              SBError &error);
97 
98   SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
99                                          bool first_insn = false);
100   SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
101                                          bool first_insn, SBError &error);
102 
103   SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address);
104   SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address,
105                                               SBError &error);
106 
107   SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
108   SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
109                                               SBError &error);
110   SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
111                                               lldb::SBStructuredData &args_data,
112                                               SBError &error);
113 
114 private:
115   friend class SBBreakpoint;
116   friend class SBBreakpointLocation;
117   friend class SBFrame;
118   friend class SBProcess;
119   friend class SBDebugger;
120   friend class SBValue;
121   friend class lldb_private::QueueImpl;
122   friend class SBQueueItem;
123 
GetSP()124   lldb::ThreadPlanSP GetSP() const { return m_opaque_wp.lock(); }
get()125   lldb_private::ThreadPlan *get() const { return GetSP().get(); }
126   void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
127 
128   lldb::ThreadPlanWP m_opaque_wp;
129 };
130 
131 } // namespace lldb
132 
133 #endif // LLDB_API_SBTHREADPLAN_H
134