37 bool given_ranges_only)
45 m_stack_id = thread.GetStackFrameAtIndex(0)->GetStackID();
46 StackFrameSP parent_stack = thread.GetStackFrameAtIndex(1);
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;
105 lldb::addr_t pc_load_addr = thread.GetRegisterContext()->GetPC();
108 for (
size_t i = 0; i < num_ranges; i++) {
117 StackFrame *frame = thread.GetStackFrameAtIndex(0).get();
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);
222 StackID cur_frame_id = thread.GetStackFrameAtIndex(0)->GetStackID();
229 StackFrameSP cur_parent_frame = thread.GetStackFrameAtIndex(1);
231 if (cur_parent_frame)
232 cur_parent_id = cur_parent_frame->GetStackID();
255 llvm_unreachable(
"Unhandled run mode!");
259 lldb::addr_t addr,
size_t &range_index,
size_t &insn_offset) {
261 for (
size_t i = 0; i < num_ranges; i++) {
269 const char *plugin_name =
nullptr;
270 const char *flavor =
nullptr;
271 const char *cpu =
nullptr;
272 const char *features =
nullptr;
274 GetTarget().GetArchitecture(), plugin_name, flavor, cpu, features,
286 ->GetInstructionList()
287 .GetIndexOfInstructionAtLoadAddress(addr,
GetTarget());
304 break_id_t bp_site_id = stop_info_sp->GetValue();
306 m_process.GetBreakpointSiteList().FindByID(bp_site_id);
317 LLDB_LOGF(log,
"Removing next branch breakpoint: %d.",
351 if (instructions ==
nullptr)
361 uint32_t last_index = instructions->
GetSize() - 1;
362 if (last_index - pc_index > 1) {
365 size_t last_inst_size = last_inst->GetOpcode().GetByteSize();
366 run_to_address = last_inst->GetAddress();
367 run_to_address.
Slide(last_inst_size);
369 }
else if (branch_index - pc_index > 1) {
373 if (branch_index == pc_index)
374 LLDB_LOGF(log,
"ThreadPlanStepRange::SetNextBranchBreakpoint - skipping "
375 "because current is branch instruction");
376 if (run_to_address.
IsValid()) {
377 const bool is_internal =
true;
393 bp_site_id = bp_site->GetID();
397 "ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
398 "breakpoint %d (site %d) to run to address 0x%" PRIx64,
407 if (bp_loc && block) {
414 if (!inlined_parent->GetRangeContainingAddress(run_to_address,
424 inlined_parent->GetInlinedFunctionInfo();
432 std::make_shared<SupportFile>(call_site_file_spec);
433 top_most_line_entry.
range = range;
434 top_most_line_entry.
file_sp.reset();
437 if (!top_most_line_entry.
file_sp)
441 if (top_most_line_entry.
IsValid()) {
442 LLDB_LOG(log,
"Setting preferred line entry: {0}:{1}",
443 top_most_line_entry.
GetFile(), top_most_line_entry.
line);
444 bp_loc->SetPreferredLineEntry(top_most_line_entry);
454 LLDB_LOGF(log,
"ThreadPlanStepRange::SetNextBranchBreakpoint - skipping "
455 "invalid run_to_address");
465 break_id_t bp_site_id = stop_info_sp->GetValue();
467 m_process.GetBreakpointSiteList().FindByID(bp_site_id);
472 size_t num_constituents = bp_site_sp->GetNumberOfConstituents();
473 bool explains_stop =
true;
478 for (
size_t i = 0; i < num_constituents; i++) {
479 if (!bp_site_sp->GetConstituentAtIndex(i)->GetBreakpoint().IsInternal()) {
480 explains_stop =
false;
486 "ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
487 "next range breakpoint which has %" PRIu64
488 " constituents - explains stop: %u.",
489 (uint64_t)num_constituents, explains_stop);
490 return explains_stop;
526 LLDB_LOGF(log,
"Completed step through range plan.");
541 LLDB_LOGF(log,
"ThreadPlanStepRange::IsPlanStale returning true, we've "
553 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, llvm::ArrayRef< AddressRange > disasm_ranges, bool force_live_memory=false)
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.
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.
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.
@ eEqualFileSpecAndChecksumIfSet
Defines a symbol context baton that can be handed other debug core functions.
LineEntry line_entry
The LineEntry for a given query.
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)
ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote report_stop_vote, Vote report_run_vote)
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::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.
lldb::SupportFileSP original_file_sp
The original source file, from debug info.
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.