1 //===-- ThreadPlanStepRange.h -----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadPlanStepRange_h_
11 #define liblldb_ThreadPlanStepRange_h_
15 // Other libraries and framework 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"
23 namespace lldb_private {
25 class ThreadPlanStepRange : public ThreadPlan {
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);
33 ~ThreadPlanStepRange() override;
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;
46 void AddRange(const AddressRange &new_range);
50 lldb::FrameComparison CompareCurrentFrameToStartFrame();
52 void DumpRanges(Stream *s);
54 Disassembler *GetDisassembler();
56 InstructionList *GetInstructionsForAddress(lldb::addr_t addr,
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();
67 void ClearNextBranchBreakpoint();
69 bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp);
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
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
82 lldb::BreakpointSP m_next_branch_bp_sp;
84 bool m_given_ranges_only;
87 std::vector<lldb::DisassemblerSP> m_instruction_ranges;
89 DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepRange);
92 } // namespace lldb_private
94 #endif // liblldb_ThreadPlanStepRange_h_