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