]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanStepRange.h
MFV 331710:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Target / ThreadPlanStepRange.h
1 //===-- ThreadPlanStepRange.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_ThreadPlanStepRange_h_
11 #define liblldb_ThreadPlanStepRange_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Core/AddressRange.h"
18 #include "lldb/Target/StackID.h"
19 #include "lldb/Target/Thread.h"
20 #include "lldb/Target/ThreadPlan.h"
21 #include "lldb/Target/ThreadPlanShouldStopHere.h"
22
23 namespace lldb_private {
24
25 class ThreadPlanStepRange : public ThreadPlan {
26 public:
27   ThreadPlanStepRange(ThreadPlanKind kind, const char *name, Thread &thread,
28                       const AddressRange &range,
29                       const SymbolContext &addr_context,
30                       lldb::RunMode stop_others,
31                       bool given_ranges_only = false);
32
33   ~ThreadPlanStepRange() override;
34
35   void GetDescription(Stream *s, lldb::DescriptionLevel level) override = 0;
36   bool ValidatePlan(Stream *error) override;
37   bool ShouldStop(Event *event_ptr) override = 0;
38   Vote ShouldReportStop(Event *event_ptr) override;
39   bool StopOthers() override;
40   lldb::StateType GetPlanRunState() override;
41   bool WillStop() override;
42   bool MischiefManaged() override;
43   void DidPush() override;
44   bool IsPlanStale() override;
45
46   void AddRange(const AddressRange &new_range);
47
48 protected:
49   bool InRange();
50   lldb::FrameComparison CompareCurrentFrameToStartFrame();
51   bool InSymbol();
52   void DumpRanges(Stream *s);
53
54   Disassembler *GetDisassembler();
55
56   InstructionList *GetInstructionsForAddress(lldb::addr_t addr,
57                                              size_t &range_index,
58                                              size_t &insn_offset);
59
60   // Pushes a plan to proceed through the next section of instructions in the
61   // range - usually just a RunToAddress
62   // plan to run to the next branch.  Returns true if it pushed such a plan.  If
63   // there was no available 'quick run'
64   // plan, then just single step.
65   bool SetNextBranchBreakpoint();
66
67   void ClearNextBranchBreakpoint();
68
69   bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp);
70
71   SymbolContext m_addr_context;
72   std::vector<AddressRange> m_address_ranges;
73   lldb::RunMode m_stop_others;
74   StackID m_stack_id; // Use the stack ID so we can tell step out from step in.
75   StackID m_parent_stack_id; // Use the parent stack ID so we can identify tail
76                              // calls and the like.
77   bool m_no_more_plans;   // Need this one so we can tell if we stepped into a
78                           // call,
79                           // but can't continue, in which case we are done.
80   bool m_first_run_event; // We want to broadcast only one running event, our
81                           // first.
82   lldb::BreakpointSP m_next_branch_bp_sp;
83   bool m_use_fast_step;
84   bool m_given_ranges_only;
85
86 private:
87   std::vector<lldb::DisassemblerSP> m_instruction_ranges;
88
89   DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepRange);
90 };
91
92 } // namespace lldb_private
93
94 #endif // liblldb_ThreadPlanStepRange_h_