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