[Lldb-commits] [lldb] 66a88f6 - [lldb] Add Function::GetAddress and redirect some uses (#115836)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 10 00:56:59 PST 2025
Author: Pavel Labath
Date: 2025-01-10T09:56:55+01:00
New Revision: 66a88f62cd56e55b5fa0ddb1bdffa549f7565f8f
URL: https://github.com/llvm/llvm-project/commit/66a88f62cd56e55b5fa0ddb1bdffa549f7565f8f
DIFF: https://github.com/llvm/llvm-project/commit/66a88f62cd56e55b5fa0ddb1bdffa549f7565f8f.diff
LOG: [lldb] Add Function::GetAddress and redirect some uses (#115836)
Many calls to Function::GetAddressRange() were not interested in the
range itself. Instead they wanted to find the address of the function
(its entry point) or the base address for relocation of function-scoped
entities (technically, the two don't need to be the same, but there's
isn't good reason for them not to be). This PR creates a separate
function for retrieving this, and changes the existing
(non-controversial) uses to call that instead.
Added:
Modified:
lldb/include/lldb/Symbol/Function.h
lldb/source/API/SBBlock.cpp
lldb/source/API/SBFunction.cpp
lldb/source/Breakpoint/BreakpointResolver.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Expression/DWARFExpressionList.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Symbol/Block.cpp
lldb/source/Symbol/Function.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Symbol/Variable.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/ThreadPlanStepInRange.cpp
lldb/source/ValueObject/ValueObjectVariable.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h
index e4118c1f9be867..157c007bdf0e84 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -449,6 +449,11 @@ class Function : public UserID, public SymbolContextScope {
AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
+ /// Return the address of the function (its entry point). This address is also
+ /// used as a base address for relocation of function-scope entities (blocks
+ /// and variables).
+ const Address &GetAddress() const { return m_address; }
+
lldb::LanguageType GetLanguage() const;
/// Find the file and line number of the source location of the start of the
/// function. This will use the declaration if present and fall back on the
@@ -658,6 +663,9 @@ class Function : public UserID, public SymbolContextScope {
/// include addresses belonging to other functions.
AddressRange m_range;
+ /// The address (entry point) of the function.
+ Address m_address;
+
/// The frame base expression for variables that are relative to the frame
/// pointer.
DWARFExpressionList m_frame_base;
diff --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp
index b921ccd9802454..2ef4cc7227cf95 100644
--- a/lldb/source/API/SBBlock.cpp
+++ b/lldb/source/API/SBBlock.cpp
@@ -176,8 +176,7 @@ bool SBBlock::GetDescription(SBStream &description) {
m_opaque_ptr->CalculateSymbolContext(&sc);
if (sc.function) {
m_opaque_ptr->DumpAddressRanges(
- &strm,
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress());
+ &strm, sc.function->GetAddress().GetFileAddress());
}
} else
strm.PutCString("No value");
diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp
index 3f6b4eea983187..414eccc357c0e4 100644
--- a/lldb/source/API/SBFunction.cpp
+++ b/lldb/source/API/SBFunction.cpp
@@ -120,8 +120,7 @@ SBInstructionList SBFunction::GetInstructions(SBTarget target,
if (m_opaque_ptr) {
TargetSP target_sp(target.GetSP());
std::unique_lock<std::recursive_mutex> lock;
- ModuleSP module_sp(
- m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule());
+ ModuleSP module_sp(m_opaque_ptr->GetAddress().GetModule());
if (target_sp && module_sp) {
lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
const bool force_live_memory = true;
diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp
index 9643602d78c751..5fe544908c39e2 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -325,7 +325,7 @@ void BreakpointResolver::AddLocation(SearchFilter &filter,
// If the line number is before the prologue end, move it there...
bool skipped_prologue = false;
if (skip_prologue && sc.function) {
- Address prologue_addr(sc.function->GetAddressRange().GetBaseAddress());
+ Address prologue_addr = sc.function->GetAddress();
if (prologue_addr.IsValid() && (line_start == prologue_addr)) {
const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
if (prologue_byte_size) {
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 264638eb836dc6..b9c8a1635d8440 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -339,7 +339,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
if (!sc.block->GetStartAddress(break_addr))
break_addr.Clear();
} else if (sc.function) {
- break_addr = sc.function->GetAddressRange().GetBaseAddress();
+ break_addr = sc.function->GetAddress();
if (m_skip_prologue && break_addr.IsValid()) {
const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
if (prologue_byte_size)
diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp
index 8027a62414bac0..6cd00af64870ae 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -152,7 +152,7 @@ bool SearchFilter::FunctionPasses(Function &function) {
// This is a slightly cheesy job, but since we don't have finer grained
// filters yet, just checking that the start address passes is probably
// good enough for the base class behavior.
- Address addr = function.GetAddressRange().GetBaseAddress();
+ Address addr = function.GetAddress();
return AddressPasses(addr);
}
diff --git a/lldb/source/Expression/DWARFExpressionList.cpp b/lldb/source/Expression/DWARFExpressionList.cpp
index 7a5cf9f9a0be46..be6c0a151159dc 100644
--- a/lldb/source/Expression/DWARFExpressionList.cpp
+++ b/lldb/source/Expression/DWARFExpressionList.cpp
@@ -126,8 +126,7 @@ bool DWARFExpressionList::MatchesOperand(
if (!sc.function)
return false;
- addr_t load_function_start =
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ addr_t load_function_start = sc.function->GetAddress().GetFileAddress();
if (load_function_start == LLDB_INVALID_ADDRESS)
return false;
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 9158b43b1c5c0d..c8b4ddf705ec48 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -731,8 +731,7 @@ class LoadAddressResolver {
// If that didn't work, try the function.
if (load_address == LLDB_INVALID_ADDRESS && candidate_sc.function) {
- Address addr =
- candidate_sc.function->GetAddressRange().GetBaseAddress();
+ Address addr = candidate_sc.function->GetAddress();
load_address = m_target->GetProcessSP() ? addr.GetLoadAddress(m_target)
: addr.GetFileAddress();
}
diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
index 27ba10524141ed..5aa903443c760c 100644
--- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
+++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
@@ -97,7 +97,7 @@ lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr,
resolve_scope, sc);
Address sym_addr;
if (sc.function)
- sym_addr = sc.function->GetAddressRange().GetBaseAddress();
+ sym_addr = sc.function->GetAddress();
else if (sc.symbol)
sym_addr = sc.symbol->GetAddress();
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 3659dfcd3c4ca3..8949b14c571893 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -796,10 +796,8 @@ bool DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) {
if (sym_ctx.symbol) {
module_sp = sym_ctx.symbol->GetAddressRef().GetModule();
}
- if (module_sp.get() == nullptr && sym_ctx.function) {
- module_sp =
- sym_ctx.function->GetAddressRange().GetBaseAddress().GetModule();
- }
+ if (module_sp.get() == nullptr && sym_ctx.function)
+ module_sp = sym_ctx.function->GetAddress().GetModule();
if (module_sp.get() == nullptr)
return false;
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 34aca50df0ac4b..5614bc32468d5c 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -856,8 +856,7 @@ bool DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo(
if (sym_ctx.symbol)
module_sp = sym_ctx.symbol->GetAddressRef().GetModule();
if (!module_sp && sym_ctx.function)
- module_sp =
- sym_ctx.function->GetAddressRange().GetBaseAddress().GetModule();
+ module_sp = sym_ctx.function->GetAddress().GetModule();
if (!module_sp)
return false;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index bbe401b827f17d..9e96f6557c7baf 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1883,7 +1883,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
return;
}
- fun_address = function->GetAddressRange().GetBaseAddress();
+ fun_address = function->GetAddress();
CompilerType copied_function_type = GuardedCopyType(function_clang_type);
if (copied_function_type) {
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index bc886259d6fa5f..45c8f121db2bc4 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -302,7 +302,7 @@ size_t SymbolFileBreakpad::ParseBlocksRecursive(Function &func) {
blocks.push_back(&func.GetBlock(false));
size_t blocks_added = 0;
- addr_t func_base = func.GetAddressRange().GetBaseAddress().GetOffset();
+ addr_t func_base = func.GetAddress().GetOffset();
CompUnitData &data = m_cu_data->GetEntryRef(comp_unit->GetID()).data;
LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
End(*m_objfile_sp);
@@ -396,7 +396,7 @@ SymbolFileBreakpad::ResolveSymbolContext(const Address &so_addr,
Block &block = func_sp->GetBlock(true);
sc.block = block.FindInnermostBlockByOffset(
so_addr.GetFileAddress() -
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress());
+ sc.function->GetAddress().GetFileAddress());
if (sc.block)
result |= eSymbolContextBlock;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index cbe077bfbaef52..0ecf47a3c7869a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1061,8 +1061,7 @@ static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp,
SymbolContext sc;
sc_list.GetContextAtIndex(i, sc);
if (sc.function) {
- const SectionSP section_sp(
- sc.function->GetAddressRange().GetBaseAddress().GetSection());
+ const SectionSP section_sp = sc.function->GetAddress().GetSection();
if (section_sp->GetModule() != module_sp) {
sc_list.RemoveContextAtIndex(i);
continue;
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 27d51bbd1cb563..53c4c126658ba3 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -416,8 +416,7 @@ Block *SymbolFileNativePDB::CreateBlock(PdbCompilandSymId block_id) {
lldbassert(func);
lldb::addr_t block_base =
m_index->MakeVirtualAddress(block.Segment, block.CodeOffset);
- lldb::addr_t func_base =
- func->GetAddressRange().GetBaseAddress().GetFileAddress();
+ lldb::addr_t func_base = func->GetAddress().GetFileAddress();
BlockSP child_block = parent_block->CreateChild(opaque_block_uid);
if (block_base >= func_base)
child_block->AddRange(Block::Range(block_base - func_base, block.CodeSize));
@@ -1113,8 +1112,7 @@ uint32_t SymbolFileNativePDB::ResolveSymbolContext(
sc.function = GetOrCreateFunction(csid, *sc.comp_unit).get();
if (sc.function) {
Block &block = sc.function->GetBlock(true);
- addr_t func_base =
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ addr_t func_base = sc.function->GetAddress().GetFileAddress();
addr_t offset = file_addr - func_base;
sc.block = block.FindInnermostBlockByOffset(offset);
}
@@ -1127,8 +1125,7 @@ uint32_t SymbolFileNativePDB::ResolveSymbolContext(
sc.function = block->CalculateSymbolContextFunction();
if (sc.function) {
sc.function->GetBlock(true);
- addr_t func_base =
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ addr_t func_base = sc.function->GetAddress().GetFileAddress();
addr_t offset = file_addr - func_base;
sc.block = block->FindInnermostBlockByOffset(offset);
}
@@ -1857,8 +1854,7 @@ VariableSP SymbolFileNativePDB::CreateLocalVariable(PdbCompilandSymId scope_id,
// when lookuping local variables in this scope.
if (!var_info.location.IsValid())
var_info.location = DWARFExpressionList(module, DWARFExpression(), nullptr);
- var_info.location.SetFuncFileAddress(
- func->GetAddressRange().GetBaseAddress().GetFileAddress());
+ var_info.location.SetFuncFileAddress(func->GetAddress().GetFileAddress());
CompilandIndexItem *cii = m_index->compilands().GetCompiland(var_id.modi);
CompUnitSP comp_unit_sp = GetOrCreateCompileUnit(*cii);
TypeSP type_sp = GetOrCreateType(var_info.type);
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp
index 5cc87240f552ad..139fa06d08fca5 100644
--- a/lldb/source/Symbol/Block.cpp
+++ b/lldb/source/Symbol/Block.cpp
@@ -39,10 +39,9 @@ void Block::GetDescription(Stream *s, Function *function,
addr_t base_addr = LLDB_INVALID_ADDRESS;
if (target)
- base_addr =
- function->GetAddressRange().GetBaseAddress().GetLoadAddress(target);
+ base_addr = function->GetAddress().GetLoadAddress(target);
if (base_addr == LLDB_INVALID_ADDRESS)
- base_addr = function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ base_addr = function->GetAddress().GetFileAddress();
s->Printf(", range%s = ", num_ranges > 1 ? "s" : "");
for (size_t i = 0; i < num_ranges; ++i) {
@@ -299,7 +298,7 @@ bool Block::GetRangeAtIndex(uint32_t range_idx, AddressRange &range) {
Function *function = CalculateSymbolContextFunction();
if (function) {
const Range &vm_range = m_ranges.GetEntryRef(range_idx);
- range.GetBaseAddress() = function->GetAddressRange().GetBaseAddress();
+ range.GetBaseAddress() = function->GetAddress();
range.GetBaseAddress().Slide(vm_range.GetRangeBase());
range.SetByteSize(vm_range.GetByteSize());
return true;
@@ -317,7 +316,7 @@ AddressRanges Block::GetRanges() {
ranges.emplace_back();
auto &range = ranges.back();
const Range &vm_range = m_ranges.GetEntryRef(i);
- range.GetBaseAddress() = function->GetAddressRange().GetBaseAddress();
+ range.GetBaseAddress() = function->GetAddress();
range.GetBaseAddress().Slide(vm_range.GetRangeBase());
range.SetByteSize(vm_range.GetByteSize());
}
@@ -330,7 +329,7 @@ bool Block::GetStartAddress(Address &addr) {
Function *function = CalculateSymbolContextFunction();
if (function) {
- addr = function->GetAddressRange().GetBaseAddress();
+ addr = function->GetAddress();
addr.Slide(m_ranges.GetEntryRef(0).GetRangeBase());
return true;
}
@@ -349,8 +348,7 @@ void Block::AddRange(const Range &range) {
if (log) {
ModuleSP module_sp(m_parent_scope.CalculateSymbolContextModule());
Function *function = m_parent_scope.CalculateSymbolContextFunction();
- const addr_t function_file_addr =
- function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ const addr_t function_file_addr = function->GetAddress().GetFileAddress();
const addr_t block_start_addr = function_file_addr + range.GetRangeBase();
const addr_t block_end_addr = function_file_addr + range.GetRangeEnd();
Type *func_type = function->GetType();
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 4f07b946353a44..c9523281dc5659 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -133,7 +133,7 @@ lldb::addr_t CallEdge::GetLoadAddress(lldb::addr_t unresolved_pc,
Function &caller, Target &target) {
Log *log = GetLog(LLDBLog::Step);
- const Address &caller_start_addr = caller.GetAddressRange().GetBaseAddress();
+ const Address &caller_start_addr = caller.GetAddress();
ModuleSP caller_module_sp = caller_start_addr.GetModule();
if (!caller_module_sp) {
@@ -279,9 +279,10 @@ Function::Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
AddressRanges ranges)
: UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid),
m_type(type), m_mangled(mangled), m_block(*this, func_uid),
- m_range(CollapseRanges(ranges)), m_prologue_byte_size(0) {
+ m_range(CollapseRanges(ranges)), m_address(m_range.GetBaseAddress()),
+ m_prologue_byte_size(0) {
assert(comp_unit != nullptr);
- lldb::addr_t base_file_addr = m_range.GetBaseAddress().GetFileAddress();
+ lldb::addr_t base_file_addr = m_address.GetFileAddress();
for (const AddressRange &range : ranges)
m_block.AddRange(
Block::Range(range.GetBaseAddress().GetFileAddress() - base_file_addr,
@@ -312,8 +313,7 @@ void Function::GetStartLineSourceInfo(SupportFileSP &source_file_sp,
return;
LineEntry line_entry;
- if (line_table->FindLineEntryByAddress(GetAddressRange().GetBaseAddress(),
- line_entry, nullptr)) {
+ if (line_table->FindLineEntryByAddress(GetAddress(), line_entry, nullptr)) {
line_no = line_entry.line;
source_file_sp = line_entry.file_sp;
}
@@ -484,7 +484,7 @@ Function *Function::CalculateSymbolContextFunction() { return this; }
lldb::DisassemblerSP Function::GetInstructions(const ExecutionContext &exe_ctx,
const char *flavor,
bool prefer_file_cache) {
- ModuleSP module_sp(GetAddressRange().GetBaseAddress().GetModule());
+ ModuleSP module_sp = GetAddress().GetModule();
if (module_sp && exe_ctx.HasTargetScope()) {
return Disassembler::DisassembleRange(
module_sp->GetArchitecture(), nullptr, nullptr, nullptr, flavor,
@@ -601,8 +601,7 @@ uint32_t Function::GetPrologueByteSize() {
if (line_table) {
LineEntry first_line_entry;
uint32_t first_line_entry_idx = UINT32_MAX;
- if (line_table->FindLineEntryByAddress(GetAddressRange().GetBaseAddress(),
- first_line_entry,
+ if (line_table->FindLineEntryByAddress(GetAddress(), first_line_entry,
&first_line_entry_idx)) {
// Make sure the first line entry isn't already the end of the prologue
addr_t prologue_end_file_addr = LLDB_INVALID_ADDRESS;
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 1a291ca3c0ea7a..19b6ff6a5302b7 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -105,8 +105,7 @@ bool SymbolContext::DumpStopContext(
if (addr_t file_addr = addr.GetFileAddress();
file_addr != LLDB_INVALID_ADDRESS) {
const addr_t function_offset =
- file_addr -
- function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ file_addr - function->GetAddress().GetFileAddress();
if (!show_function_name) {
// Print +offset even if offset is 0
dumped_something = true;
@@ -700,9 +699,7 @@ LineEntry SymbolContext::GetFunctionStartLineEntry() const {
}
if (function) {
- if (function->GetAddressRange()
- .GetBaseAddress()
- .CalculateSymbolContextLineEntry(line_entry))
+ if (function->GetAddress().CalculateSymbolContextLineEntry(line_entry))
return line_entry;
}
return LineEntry();
@@ -1228,8 +1225,7 @@ bool SymbolContextList::AppendIfUnique(const SymbolContext &sc,
continue;
if (pos->function) {
- if (pos->function->GetAddressRange().GetBaseAddress() ==
- sc.symbol->GetAddressRef()) {
+ if (pos->function->GetAddress() == sc.symbol->GetAddressRef()) {
// Do we already have a function with this symbol?
if (pos->symbol == sc.symbol)
return false;
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index a63e4f973537fa..8244725aba545a 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -221,8 +221,7 @@ bool Variable::LocationIsValidForFrame(StackFrame *frame) {
TargetSP target_sp(frame->CalculateTarget());
addr_t loclist_base_load_addr =
- function->GetAddressRange().GetBaseAddress().GetLoadAddress(
- target_sp.get());
+ function->GetAddress().GetLoadAddress(target_sp.get());
if (loclist_base_load_addr == LLDB_INVALID_ADDRESS)
return false;
// It is a location list. We just need to tell if the location list
@@ -259,7 +258,7 @@ bool Variable::LocationIsValidForAddress(const Address &address) {
if (sc.function) {
addr_t loclist_base_file_addr =
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ sc.function->GetAddress().GetFileAddress();
if (loclist_base_file_addr == LLDB_INVALID_ADDRESS)
return false;
// It is a location list. We just need to tell if the location list
@@ -450,8 +449,7 @@ bool Variable::DumpLocations(Stream *s, const Address &address) {
const addr_t file_addr = address.GetFileAddress();
if (sc.function) {
- addr_t loclist_base_file_addr =
- sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
+ addr_t loclist_base_file_addr = sc.function->GetAddress().GetFileAddress();
if (loclist_base_file_addr == LLDB_INVALID_ADDRESS)
return false;
return m_location_list.DumpLocations(s, eDescriptionLevelBrief,
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 2633c976c13bf4..4d068638f42b66 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1121,8 +1121,7 @@ llvm::Error StackFrame::GetFrameBaseValue(Scalar &frame_base) {
addr_t loclist_base_addr = LLDB_INVALID_ADDRESS;
if (!m_sc.function->GetFrameBaseExpression().IsAlwaysValidSingleExpr())
loclist_base_addr =
- m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(
- exe_ctx.GetTargetPtr());
+ m_sc.function->GetAddress().GetLoadAddress(exe_ctx.GetTargetPtr());
llvm::Expected<Value> expr_value =
m_sc.function->GetFrameBaseExpression().Evaluate(
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index 224a17d896ccf0..4a2ede8b39728f 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -250,7 +250,7 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
eSymbolContextSymbol);
if (sc.function) {
- func_start_address = sc.function->GetAddressRange().GetBaseAddress();
+ func_start_address = sc.function->GetAddress();
if (curr_addr == func_start_address.GetLoadAddress(&GetTarget()))
bytes_to_skip = sc.function->GetPrologueByteSize();
} else if (sc.symbol) {
diff --git a/lldb/source/ValueObject/ValueObjectVariable.cpp b/lldb/source/ValueObject/ValueObjectVariable.cpp
index db664ce9a7a20e..6a482b91ad4bec 100644
--- a/lldb/source/ValueObject/ValueObjectVariable.cpp
+++ b/lldb/source/ValueObject/ValueObjectVariable.cpp
@@ -160,8 +160,7 @@ bool ValueObjectVariable::UpdateValue() {
variable->CalculateSymbolContext(&sc);
if (sc.function)
loclist_base_load_addr =
- sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(
- target);
+ sc.function->GetAddress().GetLoadAddress(target);
}
Value old_value(m_value);
llvm::Expected<Value> maybe_value = expr_list.Evaluate(
More information about the lldb-commits
mailing list