37 bool given_ranges_only)
39 m_addr_context(addr_context), m_address_ranges(),
40 m_stop_others(stop_others), m_stack_id(), m_parent_stack_id(),
41 m_no_more_plans(false), m_first_run_event(true), m_use_fast_step(false),
42 m_given_ranges_only(given_ranges_only) {
62 "Could not create hardware breakpoint for thread plan.");
72 LLDB_LOGF(log,
"ThreadPlanStepRange::ShouldReportStop() returning vote %i\n",
91 if (num_ranges == 1) {
94 for (
size_t i = 0; i < num_ranges; i++) {
95 s->
Printf(
" %" PRIu64
": ", uint64_t(i));
103 bool ret_value =
false;
108 for (
size_t i = 0; i < num_ranges; i++) {
128 const bool include_inlined_functions =
131 include_inlined_functions));
141 "Step range plan stepped to another range of same line: %s",
147 const bool include_inlined_functions =
150 include_inlined_functions));
159 "Step range plan stepped to a range at linenumber 0 "
160 "stepping through that range: %s",
182 "Step range plan stepped to the middle of new "
183 "line(%d): %s, continuing to clear this line.",
191 if (!ret_value && log)
192 LLDB_LOGF(log,
"Step range plan out of range to 0x%" PRIx64, pc_load_addr);
229 if (cur_parent_frame)
230 cur_parent_id = cur_parent_frame->GetStackID();
253 llvm_unreachable(
"Unhandled run mode!");
257 lldb::addr_t addr,
size_t &range_index,
size_t &insn_offset) {
259 for (
size_t i = 0; i < num_ranges; i++) {
267 const char *plugin_name =
nullptr;
268 const char *flavor =
nullptr;
269 const char *cpu =
nullptr;
270 const char *features =
nullptr;
272 GetTarget().GetArchitecture(), plugin_name, flavor, cpu, features,
284 ->GetInstructionList()
285 .GetIndexOfInstructionAtLoadAddress(addr,
GetTarget());
302 break_id_t bp_site_id = stop_info_sp->GetValue();
315 LLDB_LOGF(log,
"Removing next branch breakpoint: %d.",
349 if (instructions ==
nullptr)
359 uint32_t last_index = instructions->
GetSize() - 1;
360 if (last_index - pc_index > 1) {
363 size_t last_inst_size = last_inst->GetOpcode().GetByteSize();
364 run_to_address = last_inst->GetAddress();
365 run_to_address.
Slide(last_inst_size);
367 }
else if (branch_index - pc_index > 1) {
371 if (branch_index == pc_index)
372 LLDB_LOGF(log,
"ThreadPlanStepRange::SetNextBranchBreakpoint - skipping "
373 "because current is branch instruction");
374 if (run_to_address.
IsValid()) {
375 const bool is_internal =
true;
391 bp_site_id = bp_site->GetID();
395 "ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
396 "breakpoint %d (site %d) to run to address 0x%" PRIx64,
405 if (bp_loc && block) {
412 if (!inlined_parent->GetRangeContainingAddress(run_to_address,
422 inlined_parent->GetInlinedFunctionInfo();
431 top_most_line_entry.
range = range;
432 top_most_line_entry.
file_sp.reset();
435 if (!top_most_line_entry.
file_sp)
439 if (top_most_line_entry.
IsValid()) {
440 LLDB_LOG(log,
"Setting preferred line entry: {0}:{1}",
441 top_most_line_entry.
GetFile(), top_most_line_entry.
line);
442 bp_loc->SetPreferredLineEntry(top_most_line_entry);
452 LLDB_LOGF(log,
"ThreadPlanStepRange::SetNextBranchBreakpoint - skipping "
453 "invalid run_to_address");
463 break_id_t bp_site_id = stop_info_sp->GetValue();
470 size_t num_constituents = bp_site_sp->GetNumberOfConstituents();
471 bool explains_stop =
true;
476 for (
size_t i = 0; i < num_constituents; i++) {
477 if (!bp_site_sp->GetConstituentAtIndex(i)->GetBreakpoint().IsInternal()) {
478 explains_stop =
false;
484 "ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
485 "next range breakpoint which has %" PRIu64
486 " constituents - explains stop: %u.",
487 (uint64_t)num_constituents, explains_stop);
488 return explains_stop;
524 LLDB_LOGF(log,
"Completed step through range plan.");
539 LLDB_LOGF(log,
"ThreadPlanStepRange::IsPlanStale returning true, we've "
551 for (
size_t i = 0; i < num_ranges; i++) {
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
bool ContainsLoadAddress(const Address &so_addr, Target *target) const
Check if a section offset so_addr when represented as a load address is contained within this object'...
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
@ DumpStyleLoadAddress
Display as the load address (if resolved).
bool Slide(int64_t offset)
lldb::addr_t GetFileAddress() const
Get the file address.
bool IsValid() const
Check if the object state is valid.
Block * CalculateSymbolContextBlock() const
A class that describes a single lexical block.
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Block * GetInlinedParent()
Get the inlined parent block for this block.
A class that describes the declaration location of a lldb object.
uint32_t GetLine() const
Get accessor for the declaration line number.
uint16_t GetColumn() const
Get accessor for the declaration column number.
FileSpec & GetFile()
Get accessor for file specification.
static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, Target &target, const AddressRange &disasm_range, bool force_live_memory=false)
const AddressRange & GetAddressRange()
DEPRECATED: Use GetAddressRanges instead.
A class that describes information for an inlined function.
Declaration & GetCallSite()
Get accessor for the call site declaration information.
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
uint32_t GetIndexOfNextBranchInstruction(uint32_t start, bool ignore_calls, bool *found_calls) const
Get the index of the next branch instruction.
StopPointSiteList< lldb_private::BreakpointSite > & GetBreakpointSiteList()
Target & GetTarget()
Get the target object pointer for this module.
This base class provides an interface to stack frames.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
StopPointSiteSP FindByID(typename StopPointSite::SiteID site_id)
Returns a shared pointer to the site with id site_id.
const char * GetData() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Wraps a FileSpec and an optional Checksum.
@ eEqualFileSpecAndChecksumIfSet
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Symbol * symbol
The Symbol for a given query.
LineEntry line_entry
The LineEntry for a given query.
bool ValueIsAddress() const
Address & GetAddressRef()
lldb::addr_t GetByteSize() const
bool GetUseFastStepping() const
bool RemoveBreakpointByID(lldb::break_id_t break_id)
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp)
void DumpRanges(Stream *s)
Vote ShouldReportStop(Event *event_ptr) override
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
lldb::BreakpointSP m_next_branch_bp_sp
bool MischiefManaged() override
SymbolContext m_addr_context
~ThreadPlanStepRange() override
lldb::FrameComparison CompareCurrentFrameToStartFrame()
bool StopOthers() override
bool SetNextBranchBreakpoint()
bool IsNextBranchBreakpointStop(lldb::StopInfoSP stop_info_sp)
ThreadPlanStepRange(ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others, bool given_ranges_only=false)
lldb::RunMode m_stop_others
StackID m_parent_stack_id
InstructionList * GetInstructionsForAddress(lldb::addr_t addr, size_t &range_index, size_t &insn_offset)
std::vector< lldb::DisassemblerSP > m_instruction_ranges
lldb::StateType GetPlanRunState() override
void ClearNextBranchBreakpointExplainedStop()
void ClearNextBranchBreakpoint()
std::vector< AddressRange > m_address_ranges
bool IsPlanStale() override
void AddRange(const AddressRange &new_range)
ThreadPlanKind GetKind() const
void SetPlanComplete(bool success=true)
Thread & GetThread()
Returns the Thread that is using this thread plan.
virtual bool MischiefManaged()
bool m_could_not_resolve_hw_bp
lldb::StopInfoSP GetPrivateStopInfo()
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
virtual lldb::RegisterContextSP GetRegisterContext()=0
#define LLDB_INVALID_BREAK_ID
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
FrameComparison
This is the return value for frame comparisons.
@ eFrameCompareSameParent
StateType
Process and Thread States.
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
std::shared_ptr< lldb_private::Instruction > InstructionSP
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
A line table entry class.
uint16_t column
The column number of the source line, or zero if there is no column information.
bool Dump(Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const
Dump a description of this object to a Stream.
lldb::SupportFileSP original_file_sp
The original source file, from debug info.
AddressRange GetSameLineContiguousAddressRange(bool include_inlined_functions) const
Give the range for this LineEntry + any additional LineEntries for this same source line that are con...
bool IsValid() const
Check if a line entry object is valid.
AddressRange range
The section offset address range for this line entry.
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.
const FileSpec & GetFile() const
Helper to access the file.
lldb::SupportFileSP file_sp
The source file, possibly mapped by the target.source-map setting.
void ApplyFileMappings(lldb::TargetSP target_sp)
Apply file mappings from target.source-map to the LineEntry's file.