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 { 27 public: 28 ThreadPlanStepRange (ThreadPlanKind kind, 29 const char *name, 30 Thread &thread, 31 const AddressRange &range, 32 const SymbolContext &addr_context, 33 lldb::RunMode stop_others, 34 bool given_ranges_only = false); 35 36 virtual ~ThreadPlanStepRange (); 37 38 virtual void GetDescription (Stream *s, lldb::DescriptionLevel level) = 0; 39 virtual bool ValidatePlan (Stream *error); 40 virtual bool ShouldStop (Event *event_ptr) = 0; 41 virtual Vote ShouldReportStop (Event *event_ptr); 42 virtual bool StopOthers (); 43 virtual lldb::StateType GetPlanRunState (); 44 virtual bool WillStop (); 45 virtual bool MischiefManaged (); 46 virtual void DidPush (); 47 virtual bool IsPlanStale (); 48 49 50 void AddRange(const AddressRange &new_range); 51 52 protected: 53 54 bool InRange(); 55 lldb::FrameComparison CompareCurrentFrameToStartFrame(); 56 bool InSymbol(); 57 void DumpRanges (Stream *s); 58 59 Disassembler * 60 GetDisassembler (); 61 62 InstructionList * 63 GetInstructionsForAddress(lldb::addr_t addr, size_t &range_index, size_t &insn_offset); 64 65 // Pushes a plan to proceed through the next section of instructions in the range - usually just a RunToAddress 66 // plan to run to the next branch. Returns true if it pushed such a plan. If there was no available 'quick run' 67 // plan, then just single step. 68 bool 69 SetNextBranchBreakpoint (); 70 71 void 72 ClearNextBranchBreakpoint(); 73 74 bool 75 NextRangeBreakpointExplainsStop (lldb::StopInfoSP stop_info_sp); 76 77 SymbolContext m_addr_context; 78 std::vector<AddressRange> m_address_ranges; 79 lldb::RunMode m_stop_others; 80 StackID m_stack_id; // Use the stack ID so we can tell step out from step in. 81 StackID m_parent_stack_id; // Use the parent stack ID so we can identify tail calls and the like. 82 bool m_no_more_plans; // Need this one so we can tell if we stepped into a call, 83 // but can't continue, in which case we are done. 84 bool m_first_run_event; // We want to broadcast only one running event, our first. 85 lldb::BreakpointSP m_next_branch_bp_sp; 86 bool m_use_fast_step; 87 bool m_given_ranges_only; 88 89 private: 90 std::vector<lldb::DisassemblerSP> m_instruction_ranges; 91 DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepRange); 92 93 }; 94 95 } // namespace lldb_private 96 97 #endif // liblldb_ThreadPlanStepRange_h_ 98