[Lldb-commits] [lldb] [lldb] Make single-argument Address constructor explicit (NFCI) (PR #189035)
Sergei Barannikov via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 27 09:13:50 PDT 2026
https://github.com/s-barannikov updated https://github.com/llvm/llvm-project/pull/189035
>From 61dcb00acfcfccce3e4d763194a27f20b04308a3 Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Fri, 27 Mar 2026 18:22:33 +0300
Subject: [PATCH 1/2] [lldb] Make single-argument Address constructor explicit
(NFCI)
This is to highlight places where we (probably unintentionally)
construct an `Address` object from an already resolved address,
making it unresolved again.
See the changes in `DynamicLoaderDarwin.cpp` for a quick example.
---
lldb/include/lldb/Core/Address.h | 2 +-
lldb/source/Breakpoint/BreakpointLocation.cpp | 4 ++--
lldb/source/Commands/CommandObjectMemory.cpp | 4 ++--
lldb/source/Commands/CommandObjectTarget.cpp | 7 ++++---
lldb/source/Core/Address.cpp | 2 +-
lldb/source/DataFormatters/FormattersHelpers.cpp | 2 +-
lldb/source/DataFormatters/StringPrinter.cpp | 3 +--
lldb/source/Expression/DWARFExpression.cpp | 8 ++++----
.../Plugins/Architecture/Mips/ArchitectureMips.cpp | 2 +-
.../FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp | 2 --
.../Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp | 2 +-
.../MacOSX-DYLD/DynamicLoaderDarwin.cpp | 3 ++-
.../InstrumentationRuntimeMainThreadChecker.cpp | 2 +-
lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp | 4 ++--
lldb/source/Plugins/Language/ObjC/CFBasicHash.h | 2 +-
lldb/source/Plugins/Language/ObjC/NSString.cpp | 14 +++++++-------
.../CPlusPlus/ItaniumABIRuntime.cpp | 2 +-
.../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 10 ++++++----
.../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp | 3 ++-
.../SymbolFile/NativePDB/SymbolFileNativePDB.cpp | 2 +-
lldb/source/Target/StackFrame.cpp | 4 ++--
lldb/source/Target/Target.cpp | 2 +-
.../source/ValueObject/ValueObjectDynamicValue.cpp | 2 +-
23 files changed, 45 insertions(+), 43 deletions(-)
diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 85b2ab7bb3cfe..71078bb44e57f 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -160,7 +160,7 @@ class Address {
/// A list of sections, one of which may contain the \a file_addr.
Address(lldb::addr_t file_addr, const SectionList *section_list);
- Address(lldb::addr_t abs_addr);
+ explicit Address(lldb::addr_t abs_addr);
/// Assignment operator.
///
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 1ec60b8fa32ec..3658085940e1a 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -49,8 +49,8 @@ BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner,
BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner)
: m_should_resolve_indirect_functions(false), m_is_reexported(false),
- m_is_indirect(false), m_address(LLDB_INVALID_ADDRESS), m_owner(owner),
- m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
+ m_is_indirect(false), m_owner(owner), m_condition_hash(0),
+ m_loc_id(loc_id), m_hit_counter() {
SetThreadIDInternal(LLDB_INVALID_THREAD_ID);
}
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 3b416028ee410..49d6eed157eb4 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -703,8 +703,8 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
std::string buffer;
buffer.resize(item_byte_size + 1, 0);
Status error;
- size_t read = target->ReadCStringFromMemory(data_addr, &buffer[0],
- item_byte_size + 1, error);
+ size_t read = target->ReadCStringFromMemory(
+ Address(data_addr), &buffer[0], item_byte_size + 1, error);
if (error.Fail()) {
result.AppendErrorWithFormat(
"failed to read memory from 0x%" PRIx64 ".\n", addr);
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 64b9500b23634..166d9ba589797 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3632,9 +3632,10 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
UnwindTable &uw_table = sc.module_sp->GetUnwindTable();
FuncUnwindersSP func_unwinders_sp =
m_options.m_cached
- ? uw_table.GetFuncUnwindersContainingAddress(start_addr, sc)
- : uw_table.GetUncachedFuncUnwindersContainingAddress(start_addr,
- sc);
+ ? uw_table.GetFuncUnwindersContainingAddress(Address(start_addr),
+ sc)
+ : uw_table.GetUncachedFuncUnwindersContainingAddress(
+ Address(start_addr), sc);
if (!func_unwinders_sp)
continue;
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index f19d22b3c0d6d..dd550028c5f7e 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -748,7 +748,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
DumpAddressRange(s->AsRawOstream(), range->GetRangeBase(),
range->GetRangeEnd(), addr_size);
s->PutCString(", location = ");
- var_sp->DumpLocations(s, all_ranges ? LLDB_INVALID_ADDRESS : *this);
+ var_sp->DumpLocations(s, all_ranges ? Address() : *this);
s->PutCString(", decl = ");
var_sp->GetDeclaration().DumpStopContext(s, false);
s->EOL();
diff --git a/lldb/source/DataFormatters/FormattersHelpers.cpp b/lldb/source/DataFormatters/FormattersHelpers.cpp
index 9b1ee8e7f6bc3..ce65de05547e7 100644
--- a/lldb/source/DataFormatters/FormattersHelpers.cpp
+++ b/lldb/source/DataFormatters/FormattersHelpers.cpp
@@ -125,7 +125,7 @@ lldb_private::formatters::GetArrayAddressOrPointerValue(ValueObject &valobj) {
data_addr.type == eAddressTypeFile)
return Address(data_addr.address, valobj.GetModule()->GetSectionList());
- return data_addr.address;
+ return Address(data_addr.address);
}
void lldb_private::formatters::DumpCxxSmartPtrPointerSummary(
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp
index 2571784250175..60cb0fc5d6876 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -404,8 +404,7 @@ static bool ReadEncodedBufferAndDumpToStream(
if (!options.GetStream())
return false;
- if (options.GetLocation() == 0 ||
- options.GetLocation() == LLDB_INVALID_ADDRESS)
+ if (options.GetLocation() == Address(0) || options.GetLocation() == Address())
return false;
lldb::TargetSP target_sp = options.GetTargetSP();
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index c23471a2c1219..7f59fe827cf25 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1899,10 +1899,10 @@ llvm::Expected<Value> DWARFExpression::Evaluate(
case Value::ValueType::LoadAddress: {
if (target) {
if (curr_piece.ResizeData(piece_byte_size) == piece_byte_size) {
- if (target->ReadMemory(addr, curr_piece.GetBuffer().GetBytes(),
- piece_byte_size, error,
- /*force_live_memory=*/false) !=
- piece_byte_size) {
+ if (target->ReadMemory(
+ Address(addr), curr_piece.GetBuffer().GetBytes(),
+ piece_byte_size, error,
+ /*force_live_memory=*/false) != piece_byte_size) {
const char *addr_type = (curr_piece_source_value_type ==
Value::ValueType::LoadAddress)
? "load"
diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
index 3748be0533ad7..bb838558269f7 100644
--- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
+++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
@@ -113,7 +113,7 @@ lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr,
if (current_offset == 0)
return addr;
- auto insn = GetInstructionAtAddress(target, current_offset, addr);
+ auto insn = GetInstructionAtAddress(target, Address(current_offset), addr);
if (nullptr == insn || !insn->HasDelaySlot())
return addr;
diff --git a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
index a0b3a4d85c4e4..00b1de6aee369 100644
--- a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -255,8 +255,6 @@ void DynamicLoaderFreeBSDKernel::DebuggerInit(
DynamicLoaderFreeBSDKernel::DynamicLoaderFreeBSDKernel(Process *process,
addr_t kernel_address)
: DynamicLoader(process), m_process(process),
- m_linker_file_list_struct_addr(LLDB_INVALID_ADDRESS),
- m_linker_file_head_addr(LLDB_INVALID_ADDRESS),
m_kernel_load_address(kernel_address), m_mutex() {
process->SetCanRunCode(false);
}
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index 2d010db960707..dc0e70a471aca 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -289,7 +289,7 @@ bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() {
// Make sure our breakpoint is at the right address.
assert(target.GetBreakpointByID(m_dyld_bid)
- ->FindLocationByAddress(break_addr)
+ ->FindLocationByAddress(Address(break_addr))
->GetBreakpoint()
.GetID() == m_dyld_bid);
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 474d908810e0e..afa0ef28a381d 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -1037,7 +1037,8 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
current_symbol->GetName().GetCString(),
actual_symbol->GetName().GetCString(),
target_addr.GetLoadAddress(target_sp.get()));
- addresses.push_back(target_addr.GetLoadAddress(target_sp.get()));
+ addresses.push_back(
+ Address(target_addr.GetLoadAddress(target_sp.get())));
}
}
}
diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
index b89a6aa176919..3b63ca2193028 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
@@ -103,7 +103,7 @@ InstrumentationRuntimeMainThreadChecker::RetrieveReportData(
std::string apiName;
Status read_error;
- target.ReadCStringFromMemory(apiname_ptr, apiName, read_error);
+ target.ReadCStringFromMemory(Address(apiname_ptr), apiName, read_error);
if (read_error.Fail())
return StructuredData::ObjectSP();
diff --git a/lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp b/lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp
index 42cda0146f2e0..e434c68c77496 100644
--- a/lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp
+++ b/lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp
@@ -6,7 +6,7 @@ using namespace lldb;
using namespace lldb_private;
bool CFBasicHash::IsValid() const {
- if (m_address != LLDB_INVALID_ADDRESS) {
+ if (m_address != Address()) {
if (m_ptr_size == 4 && m_ht_32)
return true;
else if (m_ptr_size == 8 && m_ht_64)
@@ -21,7 +21,7 @@ bool CFBasicHash::Update(addr_t addr, ExecutionContextRef exe_ctx_rf) {
if (addr == LLDB_INVALID_ADDRESS || !addr)
return false;
- m_address = addr;
+ m_address = Address(addr);
m_exe_ctx_ref = exe_ctx_rf;
m_ptr_size =
m_exe_ctx_ref.GetTargetSP()->GetArchitecture().GetAddressByteSize();
diff --git a/lldb/source/Plugins/Language/ObjC/CFBasicHash.h b/lldb/source/Plugins/Language/ObjC/CFBasicHash.h
index f850c50342a30..a85a618094d44 100644
--- a/lldb/source/Plugins/Language/ObjC/CFBasicHash.h
+++ b/lldb/source/Plugins/Language/ObjC/CFBasicHash.h
@@ -62,7 +62,7 @@ class CFBasicHash {
uint32_t m_ptr_size = UINT32_MAX;
lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid;
- Address m_address = LLDB_INVALID_ADDRESS;
+ Address m_address;
std::unique_ptr<__CFBasicHash<uint32_t>> m_ht_32 = nullptr;
std::unique_ptr<__CFBasicHash<uint64_t>> m_ht_64 = nullptr;
ExecutionContextRef m_exe_ctx_ref;
diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp
index 2626b9a3f7b8a..b7cc0062a9e68 100644
--- a/lldb/source/Plugins/Language/ObjC/NSString.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp
@@ -145,7 +145,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
if (error.Fail())
return false;
if (has_explicit_length && is_unicode) {
- options.SetLocation(location);
+ options.SetLocation(Address(location));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetQuote('"');
@@ -158,7 +158,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
return StringPrinter::ReadStringAndDumpToStream<
StringPrinter::StringElementType::UTF16>(options);
} else {
- options.SetLocation(location + 1);
+ options.SetLocation(Address(location + 1));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetSourceSize(explicit_length);
@@ -174,7 +174,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
!is_path_store && !is_mutable) {
uint64_t location = 3 * ptr_size + valobj_addr;
- options.SetLocation(location);
+ options.SetLocation(Address(location));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetQuote('"');
@@ -196,7 +196,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
if (error.Fail())
return false;
}
- options.SetLocation(location);
+ options.SetLocation(Address(location));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetQuote('"');
@@ -222,7 +222,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
explicit_length = length_valobj_sp->GetValueAsUnsigned(0) >> 20;
lldb::addr_t location = valobj.GetValueAsUnsigned(0) + ptr_size + 4;
- options.SetLocation(location);
+ options.SetLocation(Address(location));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetQuote('"');
@@ -245,7 +245,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
has_explicit_length = !(error.Fail() || explicit_length == 0);
location++;
}
- options.SetLocation(location);
+ options.SetLocation(Address(location));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetSourceSize(explicit_length);
@@ -268,7 +268,7 @@ bool lldb_private::formatters::NSStringSummaryProvider(
if (has_explicit_length && !has_null)
explicit_length++; // account for the fact that there is no NULL and we
// need to have one added
- options.SetLocation(location);
+ options.SetLocation(Address(location));
options.SetTargetSP(valobj.GetTargetSP());
options.SetStream(&stream);
options.SetSourceSize(explicit_length);
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
index 797abd8b0aa19..9a76d94b4e7c2 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
@@ -307,7 +307,7 @@ bool ItaniumABIRuntime::GetDynamicTypeAndAddress(
return false;
Status error;
const int64_t offset_to_top = target.ReadSignedIntegerFromMemory(
- offset_to_top_location, addr_byte_size, INT64_MIN, error);
+ Address(offset_to_top_location), addr_byte_size, INT64_MIN, error);
if (offset_to_top == INT64_MIN)
return false;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 565a12c4ff85e..b1994f5e94637 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -978,7 +978,8 @@ Address ObjectFileELF::GetImageInfoAddress(Target *target) {
if (symbol.d_tag == DT_MIPS_RLD_MAP) {
// DT_MIPS_RLD_MAP tag stores an absolute address of the debug pointer.
Address addr;
- if (target->ReadPointerFromMemory(d_load_addr, error, addr, true))
+ if (target->ReadPointerFromMemory(Address(d_load_addr), error, addr,
+ true))
return addr;
}
if (symbol.d_tag == DT_MIPS_RLD_MAP_REL) {
@@ -986,7 +987,8 @@ Address ObjectFileELF::GetImageInfoAddress(Target *target) {
// relative to the address of the tag.
uint64_t rel_offset;
rel_offset = target->ReadUnsignedIntegerFromMemory(
- d_load_addr, GetAddressByteSize(), UINT64_MAX, error, true);
+ Address(d_load_addr), GetAddressByteSize(), UINT64_MAX, error,
+ true);
if (error.Success() && rel_offset != UINT64_MAX) {
Address addr;
addr_t debug_ptr_address =
@@ -1025,7 +1027,7 @@ Address ObjectFileELF::GetBaseAddress() {
if (header.sh_flags & SHF_ALLOC)
return Address(GetSectionList()->FindSectionByID(SectionIndex(I)), 0);
}
- return LLDB_INVALID_ADDRESS;
+ return Address();
}
for (const auto &EnumPHdr : llvm::enumerate(ProgramHeaders())) {
@@ -1036,7 +1038,7 @@ Address ObjectFileELF::GetBaseAddress() {
return Address(
GetSectionList()->FindSectionByID(SegmentID(EnumPHdr.index())), 0);
}
- return LLDB_INVALID_ADDRESS;
+ return Address();
}
size_t ObjectFileELF::ParseDependentModules() {
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index 2f6235ea5e766..09251e2f57e1c 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -959,7 +959,8 @@ uint32_t SymbolFileCTF::ResolveSymbolContext(const Address &so_addr,
// Resolve variables.
if (resolve_scope & eSymbolContextVariable) {
for (VariableSP variable_sp : m_variables) {
- if (variable_sp->LocationIsValidForAddress(so_addr.GetFileAddress())) {
+ if (variable_sp->LocationIsValidForAddress(
+ Address(so_addr.GetFileAddress()))) {
sc.variable = variable_sp.get();
break;
}
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 1f225c4c70e29..3518a919c67da 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1826,7 +1826,7 @@ void SymbolFileNativePDB::ParseInlineSite(PdbCompilandSymId id,
S_INLINESITE) {
// Its parent is another inline site, lookup parent site's range vector
// for callsite line.
- ParseInlineSite(parent_id, func_base);
+ ParseInlineSite(parent_id, Address(func_base));
std::shared_ptr<InlineSite> parent_site =
m_inline_sites[toOpaqueUid(parent_id)];
FileSpec &parent_decl_file =
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 9fb26176e43c0..d3403403ee5e6 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -65,7 +65,7 @@ StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
: m_thread_wp(thread_sp), m_frame_index(frame_idx),
m_concrete_frame_index(unwind_frame_index), m_reg_context_sp(),
m_id(pc, cfa, nullptr, thread_sp->GetProcess().get()),
- m_frame_code_addr(pc), m_sc(), m_flags(), m_frame_base(),
+ m_frame_code_addr(Address(pc)), m_sc(), m_flags(), m_frame_base(),
m_frame_base_error(), m_cfa_is_valid(cfa_is_valid),
m_stack_frame_kind(kind), m_artificial(artificial),
m_behaves_like_zeroth_frame(behaves_like_zeroth_frame),
@@ -93,7 +93,7 @@ StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
m_concrete_frame_index(unwind_frame_index),
m_reg_context_sp(reg_context_sp),
m_id(pc, cfa, nullptr, thread_sp->GetProcess().get()),
- m_frame_code_addr(pc), m_sc(), m_flags(), m_frame_base(),
+ m_frame_code_addr(Address(pc)), m_sc(), m_flags(), m_frame_base(),
m_frame_base_error(), m_cfa_is_valid(true),
m_stack_frame_kind(StackFrame::Kind::Regular), m_artificial(false),
m_behaves_like_zeroth_frame(behaves_like_zeroth_frame),
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 126a2b57ed4b4..250d3f337a7bb 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -582,7 +582,7 @@ Target::CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal,
std::make_shared<SearchFilterForUnconstrainedSearches>(
shared_from_this());
BreakpointResolverSP resolver_sp =
- std::make_shared<BreakpointResolverAddress>(nullptr, file_addr,
+ std::make_shared<BreakpointResolverAddress>(nullptr, Address(file_addr),
file_spec);
return CreateBreakpoint(filter_sp, resolver_sp, internal, request_hardware,
false);
diff --git a/lldb/source/ValueObject/ValueObjectDynamicValue.cpp b/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
index 4c2cf0738d057..cc16869b38f03 100644
--- a/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
+++ b/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
@@ -255,7 +255,7 @@ bool ValueObjectDynamicValue::UpdateValue() {
}
m_value.GetScalar() = (uint64_t)local_buffer.data();
- m_address = LLDB_INVALID_ADDRESS;
+ m_address = Address();
} else {
// Otherwise we have a legitimate address on the target. Point to the load
// address.
>From 40983e286f0ca9e94601f5a282d0c9f76562f520 Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Fri, 27 Mar 2026 19:13:36 +0300
Subject: [PATCH 2/2] Use the constructor in more places
---
lldb/source/Commands/CommandObjectMemory.cpp | 2 +-
lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp | 2 +-
lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp | 2 +-
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp | 2 +-
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp | 2 +-
lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp | 4 ++--
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp | 2 +-
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp | 2 +-
lldb/source/Symbol/SymbolContext.cpp | 2 +-
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 49d6eed157eb4..21ee0f21b8e0e 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -655,7 +655,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
return;
}
- Address address(addr, nullptr);
+ Address address(addr);
bytes_read = target->ReadMemory(address, data_sp->GetBytes(),
data_sp->GetByteSize(), error, true);
if (bytes_read == 0) {
diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
index 338d5c152f612..dd99d47bb28ce 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
@@ -847,7 +847,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
reg_ctx->GetRegisterInfoByName("r2", 0), 0);
// We have got the address. Create a memory object out of it
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(mem_address, nullptr), return_compiler_type);
+ &thread, "", Address(mem_address), return_compiler_type);
return return_valobj_sp;
} else if (return_compiler_type.IsRealFloatingPointType()) {
if (IsSoftFloat(fp_flag)) {
diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
index 2cd49478878eb..328ddad975248 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
@@ -1121,7 +1121,7 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl(
// We have got the address. Create a memory object out of it
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(mem_address, nullptr), return_compiler_type);
+ &thread, "", Address(mem_address), return_compiler_type);
}
return return_valobj_sp;
}
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
index fea5174e8fbba..bdfc9c7e08061 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
@@ -843,7 +843,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectImpl(
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(r3_id,
0);
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(storage_addr, nullptr), return_compiler_type);
+ &thread, "", Address(storage_addr), return_compiler_type);
}
}
diff --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
index 063ca39c56475..f1abe94345371 100644
--- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
+++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
@@ -605,7 +605,7 @@ ValueObjectSP ABISysV_s390x::GetReturnValueObjectImpl(
lldb::addr_t storage_addr =
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(r2_id, 0);
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(storage_addr, nullptr), return_compiler_type);
+ &thread, "", Address(storage_addr), return_compiler_type);
}
return return_valobj_sp;
diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
index 3e31e10c78f92..b7304e8267464 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
@@ -505,7 +505,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple(
thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) &
0xffffffff);
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(storage_addr, nullptr), return_compiler_type);
+ &thread, "", Address(storage_addr), return_compiler_type);
}
} else // Neither 'Integral' nor 'Floating Point'
{
@@ -614,7 +614,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectImpl(
thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) &
0xffffffff);
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(storage_addr, nullptr), return_compiler_type);
+ &thread, "", Address(storage_addr), return_compiler_type);
}
return return_valobj_sp;
diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
index 1d184d64f5a4e..c033c0edadc82 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
@@ -841,7 +841,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectImpl(
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id,
0);
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(storage_addr, nullptr), return_compiler_type);
+ &thread, "", Address(storage_addr), return_compiler_type);
}
}
diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
index 620a247be547e..079b22a307602 100644
--- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
@@ -724,7 +724,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectImpl(
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id,
0);
return_valobj_sp = ValueObjectMemory::Create(
- &thread, "", Address(storage_addr, nullptr), return_compiler_type);
+ &thread, "", Address(storage_addr), return_compiler_type);
}
return return_valobj_sp;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 61991429c2a87..0d66a383075f1 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -1113,7 +1113,7 @@ bool SymbolContextSpecifier::AddressMatches(lldb::addr_t addr) {
if (m_type & eAddressRangeSpecified) {
} else {
- Address match_address(addr, nullptr);
+ Address match_address(addr);
SymbolContext sc;
m_target_sp->GetImages().ResolveSymbolContextForAddress(
match_address, eSymbolContextEverything, sc);
More information about the lldb-commits
mailing list