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