Skip to content

Commit 0fce489

Browse files
authored
Merge pull request #11044 from augusto2112/fix-addr-rebranch
[stable/21.x][lldb] Adapt lldb to upstream changes
2 parents 4d75905 + f69e70c commit 0fce489

File tree

8 files changed

+31
-34
lines changed

8 files changed

+31
-34
lines changed

lldb/source/Plugins/Language/Swift/SwiftFormatters.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ bool lldb_private::formatters::swift::SwiftSharedString_SummaryProvider_2(
577577
Status error;
578578
auto ptr_size = process->GetAddressByteSize();
579579

580-
lldb::addr_t raw1 = valobj.GetPointerValue();
580+
lldb::addr_t raw1 = valobj.GetPointerValue().address;
581581
lldb::addr_t address = (raw1 & 0x00FFFFFFFFFFFFFF);
582582
uint64_t startOffset = (ptr_size == 8 ? 24 : 12);
583583

@@ -604,7 +604,7 @@ bool lldb_private::formatters::swift::SwiftStringStorage_SummaryProvider(
604604
auto ptrSize = process->GetAddressByteSize();
605605
uint64_t bias = (ptrSize == 8 ? 32 : 20);
606606
uint64_t raw0_offset = (ptrSize == 8 ? 24 : 12);
607-
lldb::addr_t raw1 = valobj.GetPointerValue();
607+
lldb::addr_t raw1 = valobj.GetPointerValue().address;
608608
lldb::addr_t address = (raw1 & 0x00FFFFFFFFFFFFFF) + bias;
609609

610610
Status error;

lldb/source/Plugins/Language/Swift/SwiftHashedContainer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,14 +495,14 @@ NativeHashedStorageHandler::NativeHashedStorageHandler(
495495
return;
496496
m_keys_ptr = keys_sp->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
497497

498-
auto last_field_ptr = keys_sp->GetAddressOf();
498+
lldb::addr_t last_field_ptr = keys_sp->GetAddressOf().address;
499499

500500
if (value_type) {
501501
auto values_sp = m_storage->GetChildAtNamePath({g__rawValues, g__rawValue});
502502
if (!values_sp)
503503
return;
504504
m_values_ptr = values_sp->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
505-
last_field_ptr = values_sp->GetAddressOf();
505+
last_field_ptr = values_sp->GetAddressOf().address;
506506
}
507507

508508
m_metadata_ptr = last_field_ptr + m_ptr_size;
@@ -635,7 +635,7 @@ HashedCollectionConfig::CreateHandler(ValueObject &valobj) const {
635635
ValueObjectSP valobj_sp = valobj.GetSP();
636636
if (valobj_sp->GetObjectRuntimeLanguage() != eLanguageTypeSwift &&
637637
valobj_sp->IsPointerType()) {
638-
lldb::addr_t address = valobj_sp->GetPointerValue();
638+
lldb::addr_t address = valobj_sp->GetPointerValue().address;
639639
if (auto swiftval_sp = StorageObjectAtAddress(exe_ctx, address))
640640
valobj_sp = swiftval_sp;
641641
}
@@ -656,7 +656,7 @@ HashedCollectionConfig::CreateHandler(ValueObject &valobj) const {
656656

657657
lldb::addr_t storage_location = LLDB_INVALID_ADDRESS;
658658
if (type_name_cs == m_nativeStorageRoot_demangled)
659-
storage_location = valobj_sp->GetPointerValue();
659+
storage_location = valobj_sp->GetPointerValue().address;
660660
else {
661661
ValueObjectSP variant_sp =
662662
valobj_sp->GetChildMemberWithName(g__variant, true);

lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,7 @@ SwiftLanguage::GetHardcodedSynthetics() {
10471047
// If this is a Swift tagged pointer, the Objective-C data
10481048
// formatters may incorrectly classify it as an
10491049
// Objective-C tagged pointer.
1050-
AddressType address_type;
1051-
lldb::addr_t ptr = valobj.GetPointerValue(&address_type);
1050+
auto [ptr, address_type] = valobj.GetPointerValue();
10521051
auto *swift_runtime = SwiftLanguageRuntime::Get(process_sp);
10531052
if (!swift_runtime)
10541053
return nullptr;

lldb/source/Plugins/Language/Swift/SwiftMetatype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using namespace lldb_private::formatters::swift;
2222
bool lldb_private::formatters::swift::SwiftMetatype_SummaryProvider(
2323
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
2424
ConstString name;
25-
lldb::addr_t metadata_ptr = valobj.GetPointerValue();
25+
lldb::addr_t metadata_ptr = valobj.GetPointerValue().address;
2626
if (metadata_ptr == LLDB_INVALID_ADDRESS || metadata_ptr == 0) {
2727
CompilerType compiler_metatype_type(valobj.GetCompilerType());
2828
ExecutionContext exe_ctx = valobj.GetExecutionContextRef();

lldb/source/Plugins/Language/Swift/SwiftOptional.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ ExtractSomeIfAny(ValueObject *optional,
8686
if (kind == TypeSystemSwift::NonTriviallyManagedReferenceKind::eWeak &&
8787
runtime->IsObjCInstance(valobj))
8888
return ValueObjectCast::Create(
89-
valobj, valobj.GetPointerValue() ? g_some : g_none, projected_type);
89+
valobj, valobj.GetPointerValue().address ? g_some : g_none,
90+
projected_type);
9091

9192
// Unowned/strong reference.
9293
if (kind != TypeSystemSwift::NonTriviallyManagedReferenceKind::eWeak)
9394
return ValueObjectCast::Create(
94-
valobj, valobj.GetPointerValue() ? g_some : g_none, projected_type);
95+
valobj, valobj.GetPointerValue().address ? g_some : g_none,
96+
projected_type);
9597

9698
Status error;
97-
lldb::addr_t ptr =
98-
runtime->FixupAddress(valobj.GetPointerValue(), projected_type, error);
99+
lldb::addr_t ptr = runtime->FixupAddress(valobj.GetPointerValue().address,
100+
projected_type, error);
99101
// Needed for resilience.
100102
ptr = runtime->MaskMaybeBridgedPointer(ptr);
101103
auto exe_ctx = valobj.GetExecutionContextRef().Lock(true);
@@ -155,7 +157,7 @@ ExtractSomeIfAny(ValueObject *optional,
155157
if (!projected_type)
156158
return {};
157159
return ValueObjectCast::Create(
158-
*optional, optional->GetPointerValue() ? g_some : g_none,
160+
*optional, optional->GetPointerValue().address ? g_some : g_none,
159161
projected_type);
160162
}
161163
if (!*projected)

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
12061206

12071207
LLDBTypeInfoProvider tip(m_runtime, ts);
12081208
lldb::addr_t instance = ::MaskMaybeBridgedPointer(
1209-
m_runtime.GetProcess(), m_valobj->GetPointerValue());
1209+
m_runtime.GetProcess(), m_valobj->GetPointerValue().address);
12101210

12111211
// Try out the instance pointer based super class traversal first, as its
12121212
// usually faster.
@@ -1486,8 +1486,8 @@ SwiftLanguageRuntime::ProjectEnum(ValueObject &valobj) {
14861486

14871487
auto project_indirect_enum =
14881488
[&](uint64_t offset, std::string name) -> llvm::Expected<ValueObjectSP> {
1489-
lldb::addr_t pointer =
1490-
::MaskMaybeBridgedPointer(GetProcess(), valobj.GetPointerValue());
1489+
lldb::addr_t pointer = ::MaskMaybeBridgedPointer(
1490+
GetProcess(), valobj.GetPointerValue().address);
14911491
lldb::addr_t payload = pointer + offset;
14921492

14931493
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
@@ -1538,8 +1538,7 @@ SwiftLanguageRuntime::ProjectEnum(ValueObject &valobj) {
15381538

15391539
// Prepare to project the enum to get the active case.
15401540
MemoryReaderLocalBufferHolder holder;
1541-
AddressType address_type;
1542-
lldb::addr_t addr = valobj.GetAddressOf(false, &address_type);
1541+
auto [addr, address_type] = valobj.GetAddressOf(false);
15431542
if (addr == LLDB_INVALID_ADDRESS || addr == 0) {
15441543
Value &value = valobj.GetValue();
15451544
switch (value.GetValueType()) {
@@ -1710,7 +1709,7 @@ bool SwiftLanguageRuntime::ForEachSuperClassType(
17101709

17111710
ExecutionContext exe_ctx(instance.GetExecutionContextRef());
17121711
LLDBTypeInfoProvider tip(*this, ts);
1713-
lldb::addr_t pointer = instance.GetPointerValue();
1712+
lldb::addr_t pointer = instance.GetPointerValue().address;
17141713
return reflection_ctx->ForEachSuperClassType(&tip, ts.GetDescriptorFinder(),
17151714
pointer, fn);
17161715
}
@@ -2018,8 +2017,7 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress_Pack(
20182017
}
20192018
pack_type_or_name.SetCompilerType(*expanded_type);
20202019

2021-
AddressType address_type;
2022-
lldb::addr_t addr = in_value.GetAddressOf(true, &address_type);
2020+
auto [addr, address_type] = in_value.GetAddressOf(true);
20232021
value_type = Value::GetValueTypeFromAddressType(address_type);
20242022
if (indirect) {
20252023
Status status;
@@ -2075,8 +2073,7 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress_Class(
20752073
lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name,
20762074
Address &address, Value::ValueType &value_type,
20772075
llvm::ArrayRef<uint8_t> &local_buffer) {
2078-
AddressType address_type;
2079-
lldb::addr_t instance_ptr = in_value.GetPointerValue(&address_type);
2076+
auto [instance_ptr, address_type] = in_value.GetPointerValue();
20802077
value_type = Value::GetValueTypeFromAddressType(address_type);
20812078

20822079
if (instance_ptr == LLDB_INVALID_ADDRESS || instance_ptr == 0)
@@ -2283,7 +2280,7 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress_Existential(
22832280
existential_address = in_value.GetValue().GetScalar().ULongLong();
22842281
use_local_buffer = true;
22852282
} else {
2286-
existential_address = in_value.GetAddressOf();
2283+
existential_address = in_value.GetAddressOf().address;
22872284
}
22882285

22892286
if (log)
@@ -2405,8 +2402,7 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress_ExistentialMetatype(
24052402
lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name,
24062403
Address &address) {
24072404
// Resolve the dynamic type of the metatype.
2408-
AddressType address_type;
2409-
lldb::addr_t ptr = in_value.GetPointerValue(&address_type);
2405+
auto [ptr, address_type] = in_value.GetPointerValue();
24102406
if (ptr == LLDB_INVALID_ADDRESS || ptr == 0)
24112407
return false;
24122408

@@ -2761,8 +2757,7 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress_Value(
27612757
bound_type.GetByteSize(exe_ctx.GetBestExecutionContextScope()));
27622758
if (!size)
27632759
return false;
2764-
AddressType address_type;
2765-
lldb::addr_t val_address = in_value.GetAddressOf(true, &address_type);
2760+
auto [val_address, address_type] = in_value.GetAddressOf(true);
27662761
// If we couldn't find a load address, but the value object has a local
27672762
// buffer, use that.
27682763
if (val_address == LLDB_INVALID_ADDRESS && address_type == eAddressTypeHost) {
@@ -2832,7 +2827,7 @@ Value::ValueType SwiftLanguageRuntime::GetValueType(
28322827
existential_address = in_value.GetValue().GetScalar().ULongLong();
28332828
use_local_buffer = true;
28342829
} else {
2835-
existential_address = in_value.GetAddressOf();
2830+
existential_address = in_value.GetAddressOf().address;
28362831
}
28372832

28382833
MemoryReaderLocalBufferHolder holder;
@@ -3008,7 +3003,7 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress_ClangType(
30083003
std::string type_name =
30093004
(llvm::Twine(swift_class.module) + "." + swift_class.identifier).str();
30103005
dyn_class_type_or_name.SetName(type_name.data());
3011-
address.SetRawAddress(in_value.GetPointerValue());
3006+
address.SetRawAddress(in_value.GetPointerValue().address);
30123007
} else {
30133008
swift_class.module = swift::MANGLING_MODULE_OBJC;
30143009
swift_class.identifier = dyn_name;

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ std::optional<uint64_t> SwiftLanguageRuntime::GetMemberVariableOffsetRemoteAST(
115115
"get metadata for valueobject %s",
116116
(instance ? instance->GetName().AsCString() : "<null>"));
117117
if (instance) {
118-
lldb::addr_t pointer = instance->GetPointerValue();
118+
lldb::addr_t pointer = instance->GetPointerValue().address;
119119
if (!pointer || pointer == LLDB_INVALID_ADDRESS)
120120
break;
121121
auto address = swift::remote::RemoteAddress(

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,8 @@ static void applyOverrideOptions(std::vector<std::string> &args,
17811781
}};
17821782

17831783
clang::driver::applyOverrideOptions(raw_args, overrideOpts.data(),
1784-
savedStrings, &log_stream);
1784+
savedStrings, "CCC_OVERRIDE_OPTIONS",
1785+
&log_stream);
17851786

17861787
// Delete the placeholder "clang" executable argument.
17871788
raw_args.erase(raw_args.begin());
@@ -2946,7 +2947,7 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(
29462947
os << llvm::Triple::getOSTypeName(preferred_triple.getOS());
29472948
os << platform_version.getAsString();
29482949
}
2949-
computed_triple = llvm::Triple(buffer);
2950+
computed_triple = llvm::Triple(buffer.data());
29502951
} else if (preferred_triple.getObjectFormat() == llvm::Triple::MachO) {
29512952
LOG_PRINTF(GetLog(LLDBLog::Types),
29522953
"Completing triple based on main binary load commands.");

0 commit comments

Comments
 (0)