Skip to content

[lldb] Use Function::GetAddressRange*s* in "frame diagnose" #130949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions lldb/source/Target/StackFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,24 +1783,20 @@ lldb::ValueObjectSP StackFrame::GuessValueForRegisterAndOffset(ConstString reg,
return ValueObjectSP();
}

AddressRange pc_range = function->GetAddressRange();

if (GetFrameCodeAddress().GetFileAddress() <
pc_range.GetBaseAddress().GetFileAddress() ||
GetFrameCodeAddress().GetFileAddress() -
pc_range.GetBaseAddress().GetFileAddress() >=
pc_range.GetByteSize()) {
AddressRange unused_range;
if (!function->GetRangeContainingLoadAddress(
GetFrameCodeAddress().GetLoadAddress(target_sp.get()), *target_sp,
unused_range))
return ValueObjectSP();
}

const char *plugin_name = nullptr;
const char *flavor = nullptr;
const char *cpu = nullptr;
const char *features = nullptr;
const bool force_live_memory = true;
DisassemblerSP disassembler_sp = Disassembler::DisassembleRange(
target_arch, plugin_name, flavor, cpu, features, *target_sp, pc_range,
force_live_memory);
target_arch, plugin_name, flavor, cpu, features, *target_sp,
function->GetAddressRanges(), force_live_memory);

if (!disassembler_sp || !disassembler_sp->GetInstructionList().GetSize()) {
return ValueObjectSP();
Expand Down