LLDB  mainline
ThreadPlanStepRange.h
Go to the documentation of this file.
1 //===-- ThreadPlanStepRange.h -----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_THREADPLANSTEPRANGE_H
10 #define LLDB_TARGET_THREADPLANSTEPRANGE_H
11 
12 #include "lldb/Core/AddressRange.h"
13 #include "lldb/Target/StackID.h"
14 #include "lldb/Target/Thread.h"
15 #include "lldb/Target/ThreadPlan.h"
17 
18 namespace lldb_private {
19 
21 public:
22  ThreadPlanStepRange(ThreadPlanKind kind, const char *name, Thread &thread,
23  const AddressRange &range,
24  const SymbolContext &addr_context,
25  lldb::RunMode stop_others,
26  bool given_ranges_only = false);
27 
28  ~ThreadPlanStepRange() override;
29 
30  void GetDescription(Stream *s, lldb::DescriptionLevel level) override = 0;
31  bool ValidatePlan(Stream *error) override;
32  bool ShouldStop(Event *event_ptr) override = 0;
33  Vote ShouldReportStop(Event *event_ptr) override;
34  bool StopOthers() override;
36  bool WillStop() override;
37  bool MischiefManaged() override;
38  void DidPush() override;
39  bool IsPlanStale() override;
40 
41  void AddRange(const AddressRange &new_range);
42 
43 protected:
44  bool InRange();
46  bool InSymbol();
47  void DumpRanges(Stream *s);
48 
50 
52  size_t &range_index,
53  size_t &insn_offset);
54 
55  // Pushes a plan to proceed through the next section of instructions in the
56  // range - usually just a RunToAddress plan to run to the next branch.
57  // Returns true if it pushed such a plan. If there was no available 'quick
58  // run' plan, then just single step.
60 
62 
63  bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp);
64 
66  std::vector<AddressRange> m_address_ranges;
68  StackID m_stack_id; // Use the stack ID so we can tell step out from step in.
69  StackID m_parent_stack_id; // Use the parent stack ID so we can identify tail
70  // calls and the like.
71  bool m_no_more_plans; // Need this one so we can tell if we stepped into a
72  // call,
73  // but can't continue, in which case we are done.
74  bool m_first_run_event; // We want to broadcast only one running event, our
75  // first.
76  lldb::BreakpointSP m_next_branch_bp_sp;
79  bool m_found_calls = false; // When we set the next branch breakpoint for
80  // step over, we now extend them past call insns
81  // that directly return. But if we do that we
82  // need to run all threads, or we might cause
83  // deadlocks. This tells us whether we found
84  // any calls in setting the next branch breakpoint.
85 
86 private:
87  std::vector<lldb::DisassemblerSP> m_instruction_ranges;
88 
89  ThreadPlanStepRange(const ThreadPlanStepRange &) = delete;
90  const ThreadPlanStepRange &operator=(const ThreadPlanStepRange &) = delete;
91 };
92 
93 } // namespace lldb_private
94 
95 #endif // LLDB_TARGET_THREADPLANSTEPRANGE_H
lldb::FrameComparison
FrameComparison
This is the return value for frame comparisons.
Definition: lldb-enumerations.h:860
lldb_private::Event
Definition: Event.h:180
lldb_private::ThreadPlanStepRange::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level) override=0
Print a description of this thread to the stream s.
lldb_private::ThreadPlanStepRange::GetPlanRunState
lldb::StateType GetPlanRunState() override
Definition: ThreadPlanStepRange.cpp:426
lldb_private::ThreadPlanStepRange::m_addr_context
SymbolContext m_addr_context
Definition: ThreadPlanStepRange.h:65
lldb_private::ThreadPlanStepRange::operator=
const ThreadPlanStepRange & operator=(const ThreadPlanStepRange &)=delete
lldb_private::ThreadPlanStepRange::SetNextBranchBreakpoint
bool SetNextBranchBreakpoint()
Definition: ThreadPlanStepRange.cpp:306
lldb_private::ThreadPlanStepRange::m_next_branch_bp_sp
lldb::BreakpointSP m_next_branch_bp_sp
Definition: ThreadPlanStepRange.h:76
lldb_private::ThreadPlanStepRange::IsPlanStale
bool IsPlanStale() override
Definition: ThreadPlanStepRange.cpp:466
lldb_private::ThreadPlanStepRange
Definition: ThreadPlanStepRange.h:20
lldb_private::Stream
Definition: Stream.h:28
lldb_private::ThreadPlanStepRange::m_instruction_ranges
std::vector< lldb::DisassemblerSP > m_instruction_ranges
Definition: ThreadPlanStepRange.h:87
lldb_private::ThreadPlanStepRange::NextRangeBreakpointExplainsStop
bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp)
Definition: ThreadPlanStepRange.cpp:387
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::ThreadPlanStepRange::m_given_ranges_only
bool m_given_ranges_only
Definition: ThreadPlanStepRange.h:78
lldb_private::ThreadPlan::ThreadPlanKind
ThreadPlanKind
Definition: ThreadPlan.h:287
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ThreadPlanStepRange::m_first_run_event
bool m_first_run_event
Definition: ThreadPlanStepRange.h:74
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
lldb_private::InstructionList
Definition: Disassembler.h:267
lldb_private::ThreadPlanStepRange::m_parent_stack_id
StackID m_parent_stack_id
Definition: ThreadPlanStepRange.h:69
lldb_private::ThreadPlanStepRange::m_no_more_plans
bool m_no_more_plans
Definition: ThreadPlanStepRange.h:71
lldb_private::Thread
Definition: Thread.h:60
StackID.h
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::ThreadPlanStepRange::DidPush
void DidPush() override
Definition: ThreadPlanStepRange.cpp:52
lldb_private::ThreadPlanStepRange::AddRange
void AddRange(const AddressRange &new_range)
Definition: ThreadPlanStepRange.cpp:76
lldb_private::ThreadPlanStepRange::ClearNextBranchBreakpoint
void ClearNextBranchBreakpoint()
Definition: ThreadPlanStepRange.cpp:294
lldb_private::ThreadPlanStepRange::ThreadPlanStepRange
ThreadPlanStepRange(ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others, bool given_ranges_only=false)
Definition: ThreadPlanStepRange.cpp:31
Thread.h
lldb_private::ThreadPlanStepRange::InSymbol
bool InSymbol()
Definition: ThreadPlanStepRange.cpp:195
lldb_private::ThreadPlanStepRange::GetInstructionsForAddress
InstructionList * GetInstructionsForAddress(lldb::addr_t addr, size_t &range_index, size_t &insn_offset)
Definition: ThreadPlanStepRange.cpp:254
lldb::RunMode
RunMode
Thread Run Modes.
Definition: lldb-enumerations.h:135
ThreadPlan.h
lldb_private::ThreadPlanStepRange::m_stack_id
StackID m_stack_id
Definition: ThreadPlanStepRange.h:68
lldb_private::ThreadPlanStepRange::~ThreadPlanStepRange
~ThreadPlanStepRange() override
Definition: ThreadPlanStepRange.cpp:50
lldb_private::ThreadPlanStepRange::ShouldReportStop
Vote ShouldReportStop(Event *event_ptr) override
Definition: ThreadPlanStepRange.cpp:67
lldb_private::ThreadPlanStepRange::m_use_fast_step
bool m_use_fast_step
Definition: ThreadPlanStepRange.h:77
lldb_private::ThreadPlanStepRange::CompareCurrentFrameToStartFrame
lldb::FrameComparison CompareCurrentFrameToStartFrame()
Definition: ThreadPlanStepRange.cpp:215
lldb_private::ThreadPlanStepRange::DumpRanges
void DumpRanges(Stream *s)
Definition: ThreadPlanStepRange.cpp:88
lldb_private::Vote
Vote
Definition: lldb-private-enumerations.h:59
lldb_private::ThreadPlanStepRange::ValidatePlan
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
Definition: ThreadPlanStepRange.cpp:57
lldb_private::ThreadPlanStepRange::m_stop_others
lldb::RunMode m_stop_others
Definition: ThreadPlanStepRange.h:67
lldb_private::Disassembler
Definition: Disassembler.h:368
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::StackID
Definition: StackID.h:17
lldb_private::ThreadPlanStepRange::GetDisassembler
Disassembler * GetDisassembler()
lldb_private::ThreadPlanStepRange::m_address_ranges
std::vector< AddressRange > m_address_ranges
Definition: ThreadPlanStepRange.h:66
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::ThreadPlanStepRange::ShouldStop
bool ShouldStop(Event *event_ptr) override=0
lldb_private::ThreadPlanStepRange::m_found_calls
bool m_found_calls
Definition: ThreadPlanStepRange.h:79
lldb_private::ThreadPlanStepRange::InRange
bool InRange()
Definition: ThreadPlanStepRange.cpp:100
lldb_private::ThreadPlanStepRange::MischiefManaged
bool MischiefManaged() override
Definition: ThreadPlanStepRange.cpp:433
lldb_private::ThreadPlanStepRange::StopOthers
bool StopOthers() override
Definition: ThreadPlanStepRange.cpp:238
AddressRange.h
lldb_private::ThreadPlanStepRange::WillStop
bool WillStop() override
Definition: ThreadPlanStepRange.cpp:424
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
ThreadPlanShouldStopHere.h