ThreadPlanStepRange.h revision 341825
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
25314564Sdimclass ThreadPlanStepRange : public ThreadPlan {
26254721Semastepublic:
27314564Sdim  ThreadPlanStepRange(ThreadPlanKind kind, const char *name, Thread &thread,
28314564Sdim                      const AddressRange &range,
29314564Sdim                      const SymbolContext &addr_context,
30314564Sdim                      lldb::RunMode stop_others,
31314564Sdim                      bool given_ranges_only = false);
32254721Semaste
33314564Sdim  ~ThreadPlanStepRange() override;
34254721Semaste
35314564Sdim  void GetDescription(Stream *s, lldb::DescriptionLevel level) override = 0;
36314564Sdim  bool ValidatePlan(Stream *error) override;
37314564Sdim  bool ShouldStop(Event *event_ptr) override = 0;
38314564Sdim  Vote ShouldReportStop(Event *event_ptr) override;
39314564Sdim  bool StopOthers() override;
40314564Sdim  lldb::StateType GetPlanRunState() override;
41314564Sdim  bool WillStop() override;
42314564Sdim  bool MischiefManaged() override;
43314564Sdim  void DidPush() override;
44314564Sdim  bool IsPlanStale() override;
45254721Semaste
46314564Sdim  void AddRange(const AddressRange &new_range);
47254721Semaste
48254721Semasteprotected:
49314564Sdim  bool InRange();
50314564Sdim  lldb::FrameComparison CompareCurrentFrameToStartFrame();
51314564Sdim  bool InSymbol();
52314564Sdim  void DumpRanges(Stream *s);
53254721Semaste
54314564Sdim  Disassembler *GetDisassembler();
55254721Semaste
56314564Sdim  InstructionList *GetInstructionsForAddress(lldb::addr_t addr,
57314564Sdim                                             size_t &range_index,
58314564Sdim                                             size_t &insn_offset);
59314564Sdim
60314564Sdim  // Pushes a plan to proceed through the next section of instructions in the
61341825Sdim  // range - usually just a RunToAddress plan to run to the next branch.
62341825Sdim  // Returns true if it pushed such a plan.  If there was no available 'quick
63341825Sdim  // run' plan, then just single step.
64314564Sdim  bool SetNextBranchBreakpoint();
65314564Sdim
66314564Sdim  void ClearNextBranchBreakpoint();
67314564Sdim
68314564Sdim  bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp);
69314564Sdim
70314564Sdim  SymbolContext m_addr_context;
71314564Sdim  std::vector<AddressRange> m_address_ranges;
72314564Sdim  lldb::RunMode m_stop_others;
73314564Sdim  StackID m_stack_id; // Use the stack ID so we can tell step out from step in.
74314564Sdim  StackID m_parent_stack_id; // Use the parent stack ID so we can identify tail
75314564Sdim                             // calls and the like.
76314564Sdim  bool m_no_more_plans;   // Need this one so we can tell if we stepped into a
77314564Sdim                          // call,
78314564Sdim                          // but can't continue, in which case we are done.
79314564Sdim  bool m_first_run_event; // We want to broadcast only one running event, our
80314564Sdim                          // first.
81314564Sdim  lldb::BreakpointSP m_next_branch_bp_sp;
82314564Sdim  bool m_use_fast_step;
83314564Sdim  bool m_given_ranges_only;
84314564Sdim
85254721Semasteprivate:
86314564Sdim  std::vector<lldb::DisassemblerSP> m_instruction_ranges;
87296417Sdim
88314564Sdim  DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepRange);
89254721Semaste};
90254721Semaste
91254721Semaste} // namespace lldb_private
92254721Semaste
93296417Sdim#endif // liblldb_ThreadPlanStepRange_h_
94