ThreadPlanStepRange.h revision 254721
1254721Semaste//===-- ThreadPlanStepRange.h -----------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_ThreadPlanStepRange_h_
11254721Semaste#define liblldb_ThreadPlanStepRange_h_
12254721Semaste
13254721Semaste// C Includes
14254721Semaste// C++ Includes
15254721Semaste// Other libraries and framework includes
16254721Semaste// Project includes
17254721Semaste#include "lldb/Core/AddressRange.h"
18254721Semaste#include "lldb/Target/StackID.h"
19254721Semaste#include "lldb/Target/Thread.h"
20254721Semaste#include "lldb/Target/ThreadPlan.h"
21254721Semaste#include "lldb/Target/ThreadPlanShouldStopHere.h"
22254721Semaste
23254721Semastenamespace lldb_private {
24254721Semaste
25254721Semasteclass ThreadPlanStepRange : public ThreadPlan
26254721Semaste{
27254721Semastepublic:
28254721Semaste    ThreadPlanStepRange (ThreadPlanKind kind,
29254721Semaste                         const char *name,
30254721Semaste                         Thread &thread,
31254721Semaste                         const AddressRange &range,
32254721Semaste                         const SymbolContext &addr_context,
33254721Semaste                         lldb::RunMode stop_others);
34254721Semaste
35254721Semaste    virtual ~ThreadPlanStepRange ();
36254721Semaste
37254721Semaste    virtual void GetDescription (Stream *s, lldb::DescriptionLevel level) = 0;
38254721Semaste    virtual bool ValidatePlan (Stream *error);
39254721Semaste    virtual bool ShouldStop (Event *event_ptr) = 0;
40254721Semaste    virtual Vote ShouldReportStop (Event *event_ptr);
41254721Semaste    virtual bool StopOthers ();
42254721Semaste    virtual lldb::StateType GetPlanRunState ();
43254721Semaste    virtual bool WillStop ();
44254721Semaste    virtual bool MischiefManaged ();
45254721Semaste    virtual void DidPush ();
46254721Semaste    virtual bool IsPlanStale ();
47254721Semaste
48254721Semaste
49254721Semaste    void AddRange(const AddressRange &new_range);
50254721Semaste
51254721Semasteprotected:
52254721Semaste
53254721Semaste    bool InRange();
54254721Semaste    lldb::FrameComparison CompareCurrentFrameToStartFrame();
55254721Semaste    bool InSymbol();
56254721Semaste    void DumpRanges (Stream *s);
57254721Semaste
58254721Semaste    Disassembler *
59254721Semaste    GetDisassembler ();
60254721Semaste
61254721Semaste    InstructionList *
62254721Semaste    GetInstructionsForAddress(lldb::addr_t addr, size_t &range_index, size_t &insn_offset);
63254721Semaste
64254721Semaste    // Pushes a plan to proceed through the next section of instructions in the range - usually just a RunToAddress
65254721Semaste    // plan to run to the next branch.  Returns true if it pushed such a plan.  If there was no available 'quick run'
66254721Semaste    // plan, then just single step.
67254721Semaste    bool
68254721Semaste    SetNextBranchBreakpoint ();
69254721Semaste
70254721Semaste    void
71254721Semaste    ClearNextBranchBreakpoint();
72254721Semaste
73254721Semaste    bool
74254721Semaste    NextRangeBreakpointExplainsStop (lldb::StopInfoSP stop_info_sp);
75254721Semaste
76254721Semaste    SymbolContext             m_addr_context;
77254721Semaste    std::vector<AddressRange> m_address_ranges;
78254721Semaste    lldb::RunMode             m_stop_others;
79254721Semaste    StackID                   m_stack_id;        // Use the stack ID so we can tell step out from step in.
80254721Semaste    bool                      m_no_more_plans;   // Need this one so we can tell if we stepped into a call,
81254721Semaste                                                 // but can't continue, in which case we are done.
82254721Semaste    bool                      m_first_run_event; // We want to broadcast only one running event, our first.
83254721Semaste    lldb::BreakpointSP        m_next_branch_bp_sp;
84254721Semaste    bool                      m_use_fast_step;
85254721Semaste
86254721Semasteprivate:
87254721Semaste    std::vector<lldb::DisassemblerSP> m_instruction_ranges;
88254721Semaste    DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepRange);
89254721Semaste
90254721Semaste};
91254721Semaste
92254721Semaste} // namespace lldb_private
93254721Semaste
94254721Semaste#endif  // liblldb_ThreadPlanStepRange_h_
95