LLDB  mainline
SBThreadPlan.h
Go to the documentation of this file.
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 
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;
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
lldb::SBBreakpointLocation
Definition: SBBreakpointLocation.h:17
lldb::SBThread
Definition: SBThread.h:20
SBDefines.h
lldb::SBError
Definition: SBError.h:20
lldb::SBValue
Definition: SBValue.h:21
LLDB_API
#define LLDB_API
Definition: lldb-defines.h:23
lldb::StopReason
StopReason
Thread stop reasons.
Definition: lldb-enumerations.h:239
lldb::SBProcess
Definition: SBProcess.h:23
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb::SBQueueItem
Definition: SBQueueItem.h:17
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
lldb::SBFrame
Definition: SBFrame.h:17
lldb::SBThreadPlan::GetSP
lldb::ThreadPlanSP GetSP() const
Definition: SBThreadPlan.h:125
lldb::SBDebugger
Definition: SBDebugger.h:34
lldb::SBThreadPlan
Definition: SBThreadPlan.h:18
lldb::SBThreadPlan::m_opaque_wp
lldb::ThreadPlanWP m_opaque_wp
Definition: SBThreadPlan.h:129
lldb_private::QueueImpl
Definition: SBQueue.cpp:28
uint32_t
lldb::SBThreadPlan
class LLDB_API SBThreadPlan
Definition: SBDefines.h:77
lldb::SBStructuredData
Definition: SBStructuredData.h:17
lldb::SBBreakpoint
Definition: SBBreakpoint.h:18
lldb::SBAddress
Definition: SBAddress.h:17
lldb::SBThreadPlan::get
lldb_private::ThreadPlan * get() const
Definition: SBThreadPlan.h:126
lldb::SBStream
Definition: SBStream.h:18
lldb
Definition: SBAddress.h:15