aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp1
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp84
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp94
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/LibCxx.h12
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp6
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp5
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp23
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp79
-rw-r--r--lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp9
-rw-r--r--lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp1
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h5
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp24
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp24
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h5
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp5
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp16
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp11
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp6
-rw-r--r--lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp83
-rw-r--r--lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfodProperties.td8
-rw-r--r--lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp6
-rw-r--r--lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp5
25 files changed, 406 insertions, 121 deletions
diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
index ff5c79aa2455..b652ede9b1f5 100644
--- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -830,6 +830,7 @@ uint32_t EmulateInstructionARM::GetFramePointerRegisterNumber() const {
case llvm::Triple::IOS:
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
+ case llvm::Triple::XROS:
// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
is_apple = true;
break;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index c6937ebca319..f0fe6c9e06d9 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1032,6 +1032,31 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
TypeSummaryImplSP(new StringSummaryFormat(
eTypeOptionHideChildren | eTypeOptionHideValue, "${var.__rep_} s")));
+ // Chrono time point types
+
+ AddCXXSummary(cpp_category_sp,
+ lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider,
+ "libc++ std::chrono::sys_seconds summary provider",
+ "^std::__[[:alnum:]]+::chrono::time_point<"
+ "std::__[[:alnum:]]+::chrono::system_clock, "
+ "std::__[[:alnum:]]+::chrono::duration<long long, "
+ "std::__[[:alnum:]]+::ratio<1, 1> "
+ "> >$",
+ eTypeOptionHideChildren | eTypeOptionHideValue |
+ eTypeOptionCascade,
+ true);
+ AddCXXSummary(cpp_category_sp,
+ lldb_private::formatters::LibcxxChronoSysDaysSummaryProvider,
+ "libc++ std::chrono::sys_seconds summary provider",
+ "^std::__[[:alnum:]]+::chrono::time_point<"
+ "std::__[[:alnum:]]+::chrono::system_clock, "
+ "std::__[[:alnum:]]+::chrono::duration<int, "
+ "std::__[[:alnum:]]+::ratio<86400, 1> "
+ "> >$",
+ eTypeOptionHideChildren | eTypeOptionHideValue |
+ eTypeOptionCascade,
+ true);
+
// Chrono calendar types
cpp_category_sp->AddTypeSummary(
@@ -1039,6 +1064,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
eTypeOptionHideValue,
"day=${var.__d_%u}")));
+
AddCXXSummary(cpp_category_sp,
lldb_private::formatters::LibcxxChronoMonthSummaryProvider,
"libc++ std::chrono::month summary provider",
@@ -1050,6 +1076,23 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
TypeSummaryImplSP(new StringSummaryFormat(
eTypeOptionHideChildren | eTypeOptionHideValue, "year=${var.__y_}")));
+ AddCXXSummary(cpp_category_sp,
+ lldb_private::formatters::LibcxxChronoWeekdaySummaryProvider,
+ "libc++ std::chrono::weekday summary provider",
+ "^std::__[[:alnum:]]+::chrono::weekday$",
+ eTypeOptionHideChildren | eTypeOptionHideValue, true);
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::weekday_indexed$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ eTypeOptionHideChildren | eTypeOptionHideValue,
+ "${var.__wd_} index=${var.__idx_%u}")));
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::weekday_last$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
+ eTypeOptionHideValue,
+ "${var.__wd_} index=last")));
cpp_category_sp->AddTypeSummary(
"^std::__[[:alnum:]]+::chrono::month_day$", eFormatterMatchRegex,
TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
@@ -1060,12 +1103,51 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
eTypeOptionHideValue,
"${var.__m_} day=last")));
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::month_weekday$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
+ eTypeOptionHideValue,
+ "${var.__m_} ${var.__wdi_}")));
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::month_weekday_last$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
+ eTypeOptionHideValue,
+ "${var.__m_} ${var.__wdl_}")));
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::year_month$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
+ eTypeOptionHideValue,
+ "${var.__y_} ${var.__m_}")));
+
AddCXXSummary(
cpp_category_sp,
lldb_private::formatters::LibcxxChronoYearMonthDaySummaryProvider,
"libc++ std::chrono::year_month_day summary provider",
"^std::__[[:alnum:]]+::chrono::year_month_day$",
eTypeOptionHideChildren | eTypeOptionHideValue, true);
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::year_month_day_last$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(eTypeOptionHideChildren |
+ eTypeOptionHideValue,
+ "${var.__y_} ${var.__mdl_}")));
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::year_month_weekday$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ eTypeOptionHideChildren | eTypeOptionHideValue,
+ "${var.__y_} ${var.__m_} ${var.__wdi_}")));
+
+ cpp_category_sp->AddTypeSummary(
+ "^std::__[[:alnum:]]+::chrono::year_month_weekday_last$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ eTypeOptionHideChildren | eTypeOptionHideValue,
+ "${var.__y_} ${var.__m_} ${var.__wdl_}")));
}
static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
@@ -1589,7 +1671,7 @@ bool CPlusPlusLanguage::GetFunctionDisplayName(
if (inline_block) {
get_function_vars = false;
- inline_info = sc->block->GetInlinedFunctionInfo();
+ inline_info = inline_block->GetInlinedFunctionInfo();
if (inline_info)
variable_list_sp = inline_block->GetBlockVariableList(true);
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index f8be4f785dc4..060324e2fcfe 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1073,18 +1073,87 @@ bool lldb_private::formatters::LibcxxWStringViewSummaryProvider(
bool success;
ValueObjectSP dataobj;
size_t size;
- std::tie( success, dataobj, size ) = LibcxxExtractStringViewData(valobj);
+ std::tie(success, dataobj, size) = LibcxxExtractStringViewData(valobj);
if (!success) {
stream << "Summary Unavailable";
return true;
}
-
return ::LibcxxWStringSummaryProvider(valobj, stream, summary_options,
dataobj, size);
}
+bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
+ ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+ ValueObjectSP ptr_sp = valobj.GetChildMemberWithName("__d_");
+ if (!ptr_sp)
+ return false;
+ ptr_sp = ptr_sp->GetChildMemberWithName("__rep_");
+ if (!ptr_sp)
+ return false;
+
+ // The date time in the chrono library is valid in the range
+ // [-32767-01-01T00:00:00Z, 32767-12-31T23:59:59Z]. A 64-bit time_t has a
+ // larger range, the function strftime is not able to format the entire range
+ // of time_t. The exact point has not been investigated; it's limited to
+ // chrono's range.
+ const std::time_t chrono_timestamp_min =
+ -1'096'193'779'200; // -32767-01-01T00:00:00Z
+ const std::time_t chrono_timestamp_max =
+ 971'890'963'199; // 32767-12-31T23:59:59Z
+
+ const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
+ if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
+ stream.Printf("timestamp=%ld s", seconds);
+ else {
+ std::array<char, 128> str;
+ std::size_t size =
+ std::strftime(str.data(), str.size(), "%FT%H:%M:%SZ", gmtime(&seconds));
+ if (size == 0)
+ return false;
+
+ stream.Printf("date/time=%s timestamp=%ld s", str.data(), seconds);
+ }
+
+ return true;
+}
+
+bool lldb_private::formatters::LibcxxChronoSysDaysSummaryProvider(
+ ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+ ValueObjectSP ptr_sp = valobj.GetChildMemberWithName("__d_");
+ if (!ptr_sp)
+ return false;
+ ptr_sp = ptr_sp->GetChildMemberWithName("__rep_");
+ if (!ptr_sp)
+ return false;
+
+ // The date time in the chrono library is valid in the range
+ // [-32767-01-01Z, 32767-12-31Z]. A 32-bit time_t has a larger range, the
+ // function strftime is not able to format the entire range of time_t. The
+ // exact point has not been investigated; it's limited to chrono's range.
+ const int chrono_timestamp_min = -12'687'428; // -32767-01-01Z
+ const int chrono_timestamp_max = 11'248'737; // 32767-12-31Z
+
+ const int days = ptr_sp->GetValueAsSigned(0);
+ if (days < chrono_timestamp_min || days > chrono_timestamp_max)
+ stream.Printf("timestamp=%d days", days);
+
+ else {
+ const std::time_t seconds = std::time_t(86400) * days;
+
+ std::array<char, 128> str;
+ std::size_t size =
+ std::strftime(str.data(), str.size(), "%FZ", gmtime(&seconds));
+ if (size == 0)
+ return false;
+
+ stream.Printf("date=%s timestamp=%d days", str.data(), days);
+ }
+
+ return true;
+}
+
bool lldb_private::formatters::LibcxxChronoMonthSummaryProvider(
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
// FIXME: These are the names used in the C++20 ostream operator. Since LLVM
@@ -1106,6 +1175,27 @@ bool lldb_private::formatters::LibcxxChronoMonthSummaryProvider(
return true;
}
+bool lldb_private::formatters::LibcxxChronoWeekdaySummaryProvider(
+ ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+ // FIXME: These are the names used in the C++20 ostream operator. Since LLVM
+ // uses C++17 it's not possible to use the ostream operator directly.
+ static const std::array<std::string_view, 7> weekdays = {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"};
+
+ ValueObjectSP ptr_sp = valobj.GetChildMemberWithName("__wd_");
+ if (!ptr_sp)
+ return false;
+
+ const unsigned weekday = ptr_sp->GetValueAsUnsigned(0);
+ if (weekday >= 0 && weekday < 7)
+ stream << "weekday=" << weekdays[weekday];
+ else
+ stream.Printf("weekday=%u", weekday);
+
+ return true;
+}
+
bool lldb_private::formatters::LibcxxChronoYearMonthDaySummaryProvider(
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
ValueObjectSP ptr_sp = valobj.GetChildMemberWithName("__y_");
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
index c252ae382dd9..72da6b2426ef 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
@@ -261,10 +261,22 @@ SyntheticChildrenFrontEnd *
LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP);
+bool LibcxxChronoSysSecondsSummaryProvider(
+ ValueObject &valobj, Stream &stream,
+ const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds
+
+bool LibcxxChronoSysDaysSummaryProvider(
+ ValueObject &valobj, Stream &stream,
+ const TypeSummaryOptions &options); // libc++ std::chrono::sys_days
+
bool LibcxxChronoMonthSummaryProvider(
ValueObject &valobj, Stream &stream,
const TypeSummaryOptions &options); // libc++ std::chrono::month
+bool LibcxxChronoWeekdaySummaryProvider(
+ ValueObject &valobj, Stream &stream,
+ const TypeSummaryOptions &options); // libc++ std::chrono::weekday
+
bool LibcxxChronoYearMonthDaySummaryProvider(
ValueObject &valobj, Stream &stream,
const TypeSummaryOptions &options); // libc++ std::chrono::year_month_day
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index dc492ac0f06d..f380d6e7e672 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1893,15 +1893,15 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::ComputeHelper(
if (loader->IsFullyInitialized()) {
switch (exe_ctx.GetTargetRef().GetDynamicClassInfoHelper()) {
case eDynamicClassInfoHelperAuto:
- [[clang::fallthrough]];
+ LLVM_FALLTHROUGH;
case eDynamicClassInfoHelperGetRealizedClassList:
if (m_runtime.m_has_objc_getRealizedClassList_trylock)
return DynamicClassInfoExtractor::objc_getRealizedClassList_trylock;
- [[clang::fallthrough]];
+ LLVM_FALLTHROUGH;
case eDynamicClassInfoHelperCopyRealizedClassList:
if (m_runtime.m_has_objc_copyRealizedClassList)
return DynamicClassInfoExtractor::objc_copyRealizedClassList;
- [[clang::fallthrough]];
+ LLVM_FALLTHROUGH;
case eDynamicClassInfoHelperRealizedClassesStruct:
return DynamicClassInfoExtractor::gdb_objc_realized_classes;
}
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 43ab87f08e19..0d95a1c12bde 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2897,9 +2897,8 @@ void ObjectFileELF::ParseSymtab(Symtab &lldb_symtab) {
if (!module_sp)
return;
- Progress progress(
- llvm::formatv("Parsing symbol table for {0}",
- m_file.GetFilename().AsCString("<Unknown>")));
+ Progress progress("Parsing symbol table",
+ m_file.GetFilename().AsCString("<Unknown>"));
ElapsedTime elapsed(module_sp->GetSymtabParseTime());
// We always want to use the main object file so we (hopefully) only have one
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp
index 9e05737d8e62..3685d6ac72ad 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp
@@ -98,26 +98,15 @@ RegisterContextPOSIX_mips64::GetRegisterInfoAtIndex(size_t reg) {
}
size_t RegisterContextPOSIX_mips64::GetRegisterSetCount() {
- ArchSpec target_arch = m_register_info_up->GetTargetArchitecture();
- switch (target_arch.GetTriple().getOS()) {
- default: {
- const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>(
- m_register_info_up.get());
- return context->GetRegisterSetCount();
- }
-
- }
+ const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>(
+ m_register_info_up.get());
+ return context->GetRegisterSetCount();
}
const RegisterSet *RegisterContextPOSIX_mips64::GetRegisterSet(size_t set) {
- ArchSpec target_arch = m_register_info_up->GetTargetArchitecture();
- switch (target_arch.GetTriple().getOS()) {
- default: {
- const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>(
- m_register_info_up.get());
- return context->GetRegisterSet(set);
- }
- }
+ const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>(
+ m_register_info_up.get());
+ return context->GetRegisterSet(set);
}
const char *RegisterContextPOSIX_mips64::GetRegisterName(unsigned reg) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index ad72b3d121e6..7bb449841851 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1180,7 +1180,8 @@ bool GDBRemoteCommunicationClient::GetDefaultThreadId(lldb::tid_t &tid) {
static void ParseOSType(llvm::StringRef value, std::string &os_name,
std::string &environment) {
if (value.equals("iossimulator") || value.equals("tvossimulator") ||
- value.equals("watchossimulator")) {
+ value.equals("watchossimulator") || value.equals("xrossimulator") ||
+ value.equals("visionossimulator")) {
environment = "simulator";
os_name = value.drop_back(environment.size()).str();
} else if (value.equals("maccatalyst")) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 316be471df92..eb42b9eb6cb6 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1089,8 +1089,8 @@ Status ProcessGDBRemote::DoAttachToProcessWithID(
const int packet_len =
::snprintf(packet, sizeof(packet), "vAttach;%" PRIx64, attach_pid);
SetID(attach_pid);
- m_async_broadcaster.BroadcastEvent(
- eBroadcastBitAsyncContinue, new EventDataBytes(packet, packet_len));
+ auto data_sp = std::make_shared<EventDataBytes>(packet, packet_len);
+ m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue, data_sp);
} else
SetExitStatus(-1, error.AsCString());
}
@@ -1127,9 +1127,9 @@ Status ProcessGDBRemote::DoAttachToProcessWithName(
endian::InlHostByteOrder(),
endian::InlHostByteOrder());
- m_async_broadcaster.BroadcastEvent(
- eBroadcastBitAsyncContinue,
- new EventDataBytes(packet.GetString().data(), packet.GetSize()));
+ auto data_sp = std::make_shared<EventDataBytes>(packet.GetString().data(),
+ packet.GetSize());
+ m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue, data_sp);
} else
SetExitStatus(-1, error.AsCString());
@@ -1374,10 +1374,9 @@ Status ProcessGDBRemote::DoResume() {
return error;
}
- m_async_broadcaster.BroadcastEvent(
- eBroadcastBitAsyncContinue,
- new EventDataBytes(continue_packet.GetString().data(),
- continue_packet.GetSize()));
+ auto data_sp = std::make_shared<EventDataBytes>(
+ continue_packet.GetString().data(), continue_packet.GetSize());
+ m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue, data_sp);
if (!listener_sp->GetEvent(event_sp, std::chrono::seconds(5))) {
error.SetErrorString("Resume timed out.");
@@ -4189,52 +4188,55 @@ static std::vector<RegisterFlags::Field> ParseFlagsFields(XMLNode flags_node,
// Note that XML in general requires that each of these attributes only
// appears once, so we don't have to handle that here.
if (attr_name == "name") {
- LLDB_LOG(log,
- "ProcessGDBRemote::ParseFlags Found field node name \"{0}\"",
- attr_value.data());
+ LLDB_LOG(
+ log,
+ "ProcessGDBRemote::ParseFlagsFields Found field node name \"{0}\"",
+ attr_value.data());
name = attr_value;
} else if (attr_name == "start") {
unsigned parsed_start = 0;
if (llvm::to_integer(attr_value, parsed_start)) {
if (parsed_start > max_start_bit) {
- LLDB_LOG(
- log,
- "ProcessGDBRemote::ParseFlags Invalid start {0} in field node, "
- "cannot be > {1}",
- parsed_start, max_start_bit);
+ LLDB_LOG(log,
+ "ProcessGDBRemote::ParseFlagsFields Invalid start {0} in "
+ "field node, "
+ "cannot be > {1}",
+ parsed_start, max_start_bit);
} else
start = parsed_start;
} else {
- LLDB_LOG(log,
- "ProcessGDBRemote::ParseFlags Invalid start \"{0}\" in "
- "field node",
- attr_value.data());
+ LLDB_LOG(
+ log,
+ "ProcessGDBRemote::ParseFlagsFields Invalid start \"{0}\" in "
+ "field node",
+ attr_value.data());
}
} else if (attr_name == "end") {
unsigned parsed_end = 0;
if (llvm::to_integer(attr_value, parsed_end))
if (parsed_end > max_start_bit) {
- LLDB_LOG(
- log,
- "ProcessGDBRemote::ParseFlags Invalid end {0} in field node, "
- "cannot be > {1}",
- parsed_end, max_start_bit);
+ LLDB_LOG(log,
+ "ProcessGDBRemote::ParseFlagsFields Invalid end {0} in "
+ "field node, "
+ "cannot be > {1}",
+ parsed_end, max_start_bit);
} else
end = parsed_end;
else {
- LLDB_LOG(
- log,
- "ProcessGDBRemote::ParseFlags Invalid end \"{0}\" in field node",
- attr_value.data());
+ LLDB_LOG(log,
+ "ProcessGDBRemote::ParseFlagsFields Invalid end \"{0}\" in "
+ "field node",
+ attr_value.data());
}
} else if (attr_name == "type") {
// Type is a known attribute but we do not currently use it and it is
// not required.
} else {
- LLDB_LOG(log,
- "ProcessGDBRemote::ParseFlags Ignoring unknown attribute "
- "\"{0}\" in field node",
- attr_name.data());
+ LLDB_LOG(
+ log,
+ "ProcessGDBRemote::ParseFlagsFields Ignoring unknown attribute "
+ "\"{0}\" in field node",
+ attr_name.data());
}
return true; // Walk all attributes of the field.
@@ -4242,10 +4244,11 @@ static std::vector<RegisterFlags::Field> ParseFlagsFields(XMLNode flags_node,
if (name && start && end) {
if (*start > *end) {
- LLDB_LOG(log,
- "ProcessGDBRemote::ParseFlags Start {0} > end {1} in field "
- "\"{2}\", ignoring",
- *start, *end, name->data());
+ LLDB_LOG(
+ log,
+ "ProcessGDBRemote::ParseFlagsFields Start {0} > end {1} in field "
+ "\"{2}\", ignoring",
+ *start, *end, name->data());
} else {
fields.push_back(RegisterFlags::Field(name->str(), *start, *end));
}
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 47c8074adc5b..b1f7397d6b0f 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -216,10 +216,11 @@ CompUnitSP SymbolFileBreakpad::ParseCompileUnitAtIndex(uint32_t index) {
spec = (*m_files)[record->FileNum];
}
- auto cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(),
- /*user_data*/ nullptr, spec, index,
- eLanguageTypeUnknown,
- /*is_optimized*/ eLazyBoolNo);
+ auto cu_sp = std::make_shared<CompileUnit>(
+ m_objfile_sp->GetModule(),
+ /*user_data*/ nullptr, std::make_shared<SupportFile>(spec), index,
+ eLanguageTypeUnknown,
+ /*is_optimized*/ eLazyBoolNo);
SetCompileUnitAtIndex(index, cu_sp);
return cu_sp;
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index d192944bb9d0..65f5b1a5f1b0 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -603,6 +603,7 @@ llvm::Expected<TypeSP> SymbolFileCTF::CreateType(CTFType *ctf_type) {
ctf_type->uid, ctf_type->name, ctf_type->kind),
llvm::inconvertibleErrorCode());
}
+ llvm_unreachable("Unexpected CTF type kind");
}
llvm::Expected<std::unique_ptr<CTFType>>
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 553b6a4c551d..340b9acf80d0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -191,3 +191,9 @@ DWARFDebugInfo::GetDIE(const DIERef &die_ref) {
return cu->GetNonSkeletonUnit().GetDIE(die_ref.die_offset());
return DWARFDIE(); // Not found
}
+
+llvm::StringRef DWARFDebugInfo::PeekDIEName(const DIERef &die_ref) {
+ if (DWARFUnit *cu = GetUnit(die_ref))
+ return cu->GetNonSkeletonUnit().PeekDIEName(die_ref.die_offset());
+ return llvm::StringRef();
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index d5e48f312ea0..a8b5abc3beed 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -43,6 +43,11 @@ public:
bool ContainsTypeUnits();
DWARFDIE GetDIE(const DIERef &die_ref);
+ /// Returns the AT_Name of this DIE, if it exists, without parsing the entire
+ /// compile unit. An empty is string is returned upon error or if the
+ /// attribute is not present.
+ llvm::StringRef PeekDIEName(const DIERef &die_ref);
+
enum {
eDumpFlag_Verbose = (1 << 0), // Verbose dumping
eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 0a7029a55c04..e1f73f1997e3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -18,8 +18,6 @@
#include "DWARFFormValue.h"
#include "DWARFUnit.h"
-class DWARFUnit;
-
using namespace lldb_private;
using namespace lldb_private::dwarf;
using namespace lldb_private::plugin::dwarf;
@@ -502,7 +500,8 @@ dw_addr_t DWARFFormValue::Address() const {
&offset, index_size);
}
-DWARFDIE DWARFFormValue::Reference() const {
+std::pair<DWARFUnit *, uint64_t>
+DWARFFormValue::ReferencedUnitAndOffset() const {
uint64_t value = m_value.value.uval;
switch (m_form) {
case DW_FORM_ref1:
@@ -516,9 +515,9 @@ DWARFDIE DWARFFormValue::Reference() const {
if (!m_unit->ContainsDIEOffset(value)) {
m_unit->GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
"DW_FORM_ref* DIE reference {0:x16} is outside of its CU", value);
- return {};
+ return {nullptr, 0};
}
- return const_cast<DWARFUnit *>(m_unit)->GetDIE(value);
+ return {const_cast<DWARFUnit *>(m_unit), value};
case DW_FORM_ref_addr: {
DWARFUnit *ref_cu =
@@ -527,24 +526,29 @@ DWARFDIE DWARFFormValue::Reference() const {
if (!ref_cu) {
m_unit->GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
"DW_FORM_ref_addr DIE reference {0:x16} has no matching CU", value);
- return {};
+ return {nullptr, 0};
}
- return ref_cu->GetDIE(value);
+ return {ref_cu, value};
}
case DW_FORM_ref_sig8: {
DWARFTypeUnit *tu =
m_unit->GetSymbolFileDWARF().DebugInfo().GetTypeUnitForHash(value);
if (!tu)
- return {};
- return tu->GetDIE(tu->GetTypeOffset());
+ return {nullptr, 0};
+ return {tu, tu->GetTypeOffset()};
}
default:
- return {};
+ return {nullptr, 0};
}
}
+DWARFDIE DWARFFormValue::Reference() const {
+ auto [unit, offset] = ReferencedUnitAndOffset();
+ return unit ? unit->GetDIE(offset) : DWARFDIE();
+}
+
uint64_t DWARFFormValue::Reference(dw_offset_t base_offset) const {
uint64_t value = m_value.value.uval;
switch (m_form) {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
index 445749a6aac3..fdd5b3c278a4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
@@ -60,6 +60,12 @@ public:
const DWARFUnit *u);
std::optional<uint8_t> GetFixedSize() const;
DWARFDIE Reference() const;
+
+ /// If this is a reference to another DIE, return the corresponding DWARFUnit
+ /// and DIE offset such that Unit->GetDIE(offset) produces the desired DIE.
+ /// Otherwise, a nullptr and unspecified offset are returned.
+ std::pair<DWARFUnit *, uint64_t> ReferencedUnitAndOffset() const;
+
uint64_t Reference(dw_offset_t offset) const;
bool Boolean() const { return m_value.value.uval != 0; }
uint64_t Unsigned() const { return m_value.value.uval; }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 0e2f4d45543b..7a40361cdede 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -663,6 +663,30 @@ DWARFUnit::GetDIE(dw_offset_t die_offset) {
return DWARFDIE(); // Not found
}
+llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) {
+ DWARFDebugInfoEntry die;
+ if (!die.Extract(GetData(), this, &die_offset))
+ return llvm::StringRef();
+
+ // Does die contain a DW_AT_Name?
+ if (const char *name =
+ die.GetAttributeValueAsString(this, DW_AT_name, nullptr))
+ return name;
+
+ // Does its DW_AT_specification or DW_AT_abstract_origin contain an AT_Name?
+ for (auto attr : {DW_AT_specification, DW_AT_abstract_origin}) {
+ DWARFFormValue form_value;
+ if (!die.GetAttributeValue(this, attr, form_value))
+ continue;
+ auto [unit, offset] = form_value.ReferencedUnitAndOffset();
+ if (unit)
+ if (auto name = unit->PeekDIEName(offset); !name.empty())
+ return name;
+ }
+
+ return llvm::StringRef();
+}
+
DWARFUnit &DWARFUnit::GetNonSkeletonUnit() {
ExtractUnitDIEIfNeeded();
if (m_dwo)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 3f528e913d8c..bc225a52e1d0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -187,6 +187,11 @@ public:
DWARFDIE GetDIE(dw_offset_t die_offset);
+ /// Returns the AT_Name of the DIE at `die_offset`, if it exists, without
+ /// parsing the entire compile unit. An empty is string is returned upon
+ /// error or if the attribute is not present.
+ llvm::StringRef PeekDIEName(dw_offset_t die_offset);
+
DWARFUnit &GetNonSkeletonUnit();
static uint8_t GetAddressByteSize(const DWARFUnit *cu);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 16ff5f7d4842..92275600f99c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -75,9 +75,8 @@ void ManualDWARFIndex::Index() {
// Include 2 passes per unit to index for extracting DIEs from the unit and
// indexing the unit, and then 8 extra entries for finalizing each index set.
const uint64_t total_progress = units_to_index.size() * 2 + 8;
- Progress progress(
- llvm::formatv("Manually indexing DWARF for {0}", module_desc.GetData()),
- total_progress);
+ Progress progress("Manually indexing DWARF", module_desc.GetData(),
+ total_progress);
std::vector<IndexSet> sets(units_to_index.size());
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 1a16b70f42fe..fed97858c83f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -294,7 +294,7 @@ static void ParseSupportFilesFromPrologue(
}
// Unconditionally add an entry, so the indices match up.
- support_files.EmplaceBack(remapped_file, style, checksum);
+ support_files.EmplaceBack(FileSpec(remapped_file, style), checksum);
}
}
@@ -519,8 +519,6 @@ void SymbolFileDWARF::InitializeObject() {
if (apple_names.GetByteSize() > 0 || apple_namespaces.GetByteSize() > 0 ||
apple_types.GetByteSize() > 0 || apple_objc.GetByteSize() > 0) {
- Progress progress(llvm::formatv("Loading Apple DWARF index for {0}",
- module_desc.GetData()));
m_index = AppleDWARFIndex::Create(
*GetObjectFile()->GetModule(), apple_names, apple_namespaces,
apple_types, apple_objc, m_context.getOrLoadStrData());
@@ -532,8 +530,7 @@ void SymbolFileDWARF::InitializeObject() {
DWARFDataExtractor debug_names;
LoadSectionData(eSectionTypeDWARFDebugNames, debug_names);
if (debug_names.GetByteSize() > 0) {
- Progress progress(
- llvm::formatv("Loading DWARF5 index for {0}", module_desc.GetData()));
+ Progress progress("Loading DWARF5 index", module_desc.GetData());
llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>> index_or =
DebugNamesDWARFIndex::Create(*GetObjectFile()->GetModule(),
debug_names,
@@ -786,12 +783,12 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
} else {
ModuleSP module_sp(m_objfile_sp->GetModule());
if (module_sp) {
- auto initialize_cu = [&](const FileSpec &file_spec,
+ auto initialize_cu = [&](lldb::SupportFileSP support_file_sp,
LanguageType cu_language,
SupportFileList &&support_files = {}) {
BuildCuTranslationTable();
cu_sp = std::make_shared<CompileUnit>(
- module_sp, &dwarf_cu, file_spec,
+ module_sp, &dwarf_cu, support_file_sp,
*GetDWARFUnitIndex(dwarf_cu.GetID()), cu_language,
eLazyBoolCalculate, std::move(support_files));
@@ -824,7 +821,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
return false;
if (support_files.GetSize() == 0)
return false;
- initialize_cu(support_files.GetFileSpecAtIndex(0),
+ initialize_cu(support_files.GetSupportFileAtIndex(0),
eLanguageTypeUnknown, std::move(support_files));
return true;
};
@@ -843,7 +840,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
// case ParseSupportFiles takes care of the remapping.
MakeAbsoluteAndRemap(cu_file_spec, dwarf_cu, module_sp);
- initialize_cu(cu_file_spec, cu_language);
+ initialize_cu(std::make_shared<SupportFile>(cu_file_spec),
+ cu_language);
}
}
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 9094a5e21e69..6dd3eb3677b7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -598,10 +598,10 @@ CompUnitSP SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) {
// User zero as the ID to match the compile unit at offset zero in each
// .o file.
lldb::user_id_t cu_id = 0;
- cu_info.compile_units_sps.push_back(
- std::make_shared<CompileUnit>(
- m_objfile_sp->GetModule(), nullptr, so_file_spec, cu_id,
- eLanguageTypeUnknown, eLazyBoolCalculate));
+ cu_info.compile_units_sps.push_back(std::make_shared<CompileUnit>(
+ m_objfile_sp->GetModule(), nullptr,
+ std::make_shared<SupportFile>(so_file_spec), cu_id,
+ eLanguageTypeUnknown, eLazyBoolCalculate));
cu_info.id_to_index_map.insert({0, 0});
SetCompileUnitAtIndex(cu_idx, cu_info.compile_units_sps[0]);
// If there's a symbol file also register all the extra compile units.
@@ -615,7 +615,8 @@ CompUnitSP SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) {
if (dwarf_cu->GetID() == 0)
continue;
cu_info.compile_units_sps.push_back(std::make_shared<CompileUnit>(
- m_objfile_sp->GetModule(), nullptr, so_file_spec,
+ m_objfile_sp->GetModule(), nullptr,
+ std::make_shared<SupportFile>(so_file_spec),
dwarf_cu->GetID(), eLanguageTypeUnknown, eLazyBoolCalculate));
cu_info.id_to_index_map.insert(
{dwarf_cu->GetID(), cu_info.compile_units_sps.size() - 1});
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 9234768323e7..745685a1b31d 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -534,9 +534,9 @@ SymbolFileNativePDB::CreateCompileUnit(const CompilandIndexItem &cci) {
FileSpec fs(llvm::sys::path::convert_to_slash(
source_file_name, llvm::sys::path::Style::windows_backslash));
- CompUnitSP cu_sp =
- std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr, fs,
- toOpaqueUid(cci.m_id), lang, optimized);
+ CompUnitSP cu_sp = std::make_shared<CompileUnit>(
+ m_objfile_sp->GetModule(), nullptr, std::make_shared<SupportFile>(fs),
+ toOpaqueUid(cci.m_id), lang, optimized);
SetCompileUnitAtIndex(cci.m_id.modi, cu_sp);
return cu_sp;
diff --git a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index 111be6be3652..2cd7bbbb2449 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -9,7 +9,10 @@
#include "SymbolLocatorDebuginfod.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Utility/Args.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
#include "llvm/Debuginfod/Debuginfod.h"
#include "llvm/Debuginfod/HTTPClient.h"
@@ -54,6 +57,32 @@ public:
return urls;
}
+ llvm::Expected<std::string> GetCachePath() {
+ OptionValueString *s =
+ m_collection_sp->GetPropertyAtIndexAsOptionValueString(
+ ePropertySymbolCachePath);
+ // If we don't have a valid cache location, use the default one.
+ if (!s || !s->GetCurrentValueAsRef().size()) {
+ llvm::Expected<std::string> maybeCachePath =
+ llvm::getDefaultDebuginfodCacheDirectory();
+ if (!maybeCachePath)
+ return maybeCachePath;
+ return *maybeCachePath;
+ }
+ return s->GetCurrentValue();
+ }
+
+ std::chrono::milliseconds GetTimeout() const {
+ std::optional<uint64_t> seconds =
+ m_collection_sp->GetPropertyAtIndexAs<uint64_t>(ePropertyTimeout);
+ if (seconds && *seconds != 0) {
+ return std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::seconds(*seconds));
+ } else {
+ return llvm::getDefaultDebuginfodTimeout();
+ }
+ }
+
private:
void ServerURLsChangedCallback() {
m_server_urls = GetDebugInfoDURLs();
@@ -112,31 +141,51 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
return new SymbolLocatorDebuginfod();
}
-static std::optional<FileSpec> GetFileForModule(
- const ModuleSpec &module_spec,
- std::function<llvm::Expected<std::string>(llvm::object::BuildIDRef)>
- PullFromServer) {
- if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup())
- return {};
+static std::optional<FileSpec>
+GetFileForModule(const ModuleSpec &module_spec,
+ std::function<std::string(llvm::object::BuildID)> UrlBuilder) {
const UUID &module_uuid = module_spec.GetUUID();
- if (module_uuid.IsValid() && llvm::canUseDebuginfod()) {
- llvm::object::BuildID build_id(module_uuid.GetBytes());
- llvm::Expected<std::string> result = PullFromServer(build_id);
- if (result)
- return FileSpec(*result);
- // An error here should be logged as a failure in the Debuginfod library,
- // so just consume it here
- consumeError(result.takeError());
- }
+ // Don't bother if we don't have a valid UUID, Debuginfod isn't available,
+ // or if the 'symbols.enable-external-lookup' setting is false.
+ if (!module_uuid.IsValid() || !llvm::canUseDebuginfod() ||
+ !ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup())
+ return {};
+
+ // Grab LLDB's Debuginfod overrides from the
+ // plugin.symbol-locator.debuginfod.* settings.
+ PluginProperties &plugin_props = GetGlobalPluginProperties();
+ llvm::Expected<std::string> cache_path_or_err = plugin_props.GetCachePath();
+ // A cache location is *required*.
+ if (!cache_path_or_err)
+ return {};
+ std::string cache_path = *cache_path_or_err;
+ llvm::SmallVector<llvm::StringRef> debuginfod_urls =
+ llvm::getDefaultDebuginfodUrls();
+ std::chrono::milliseconds timeout = plugin_props.GetTimeout();
+
+ // We're ready to ask the Debuginfod library to find our file.
+ llvm::object::BuildID build_id(module_uuid.GetBytes());
+ std::string url_path = UrlBuilder(build_id);
+ std::string cache_key = llvm::getDebuginfodCacheKey(url_path);
+ llvm::Expected<std::string> result = llvm::getCachedOrDownloadArtifact(
+ cache_key, url_path, cache_path, debuginfod_urls, timeout);
+ if (result)
+ return FileSpec(*result);
+
+ Log *log = GetLog(LLDBLog::Symbols);
+ auto err_message = llvm::toString(result.takeError());
+ LLDB_LOGV(log,
+ "Debuginfod failed to download symbol artifact {0} with error {1}",
+ url_path, err_message);
return {};
}
std::optional<ModuleSpec> SymbolLocatorDebuginfod::LocateExecutableObjectFile(
const ModuleSpec &module_spec) {
- return GetFileForModule(module_spec, llvm::getCachedOrDownloadExecutable);
+ return GetFileForModule(module_spec, llvm::getDebuginfodExecutableUrlPath);
}
std::optional<FileSpec> SymbolLocatorDebuginfod::LocateExecutableSymbolFile(
const ModuleSpec &module_spec, const FileSpecList &default_search_paths) {
- return GetFileForModule(module_spec, llvm::getCachedOrDownloadDebuginfo);
+ return GetFileForModule(module_spec, llvm::getDebuginfodDebuginfoUrlPath);
}
diff --git a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfodProperties.td b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfodProperties.td
index 1c668b001a16..0ff02674b8ea 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfodProperties.td
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfodProperties.td
@@ -1,7 +1,13 @@
include "../../../../include/lldb/Core/PropertiesBase.td"
let Definition = "symbollocatordebuginfod" in {
- def ServerURLs : Property<"server_urls", "Array">,
+ def ServerURLs : Property<"server-urls", "Array">,
ElementType<"String">,
Desc<"An ordered list of Debuginfod server URLs to query for symbols. This defaults to the contents of the DEBUGINFOD_URLS environment variable.">;
+ def SymbolCachePath: Property<"cache-path", "String">,
+ DefaultStringValue<"">,
+ Desc<"The path where symbol files should be cached. This defaults to LLDB's system cache location.">;
+ def Timeout : Property<"timeout", "UInt64">,
+ DefaultUnsignedValue<0>,
+ Desc<"Timeout (in seconds) for requests made to a DEBUGINFOD server. A value of zero means we use the debuginfod default timeout: DEBUGINFOD_TIMEOUT if the environment variable is set and 90 seconds otherwise.">;
}
diff --git a/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp b/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp
index ed014f99fdb5..6f0126b16cdc 100644
--- a/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp
@@ -98,9 +98,9 @@ std::optional<FileSpec> SymbolLocatorDefault::LocateExecutableSymbolFile(
FileSystem::Instance().Exists(symbol_file_spec))
return symbol_file_spec;
- Progress progress(llvm::formatv(
- "Locating external symbol file for {0}",
- module_spec.GetFileSpec().GetFilename().AsCString("<Unknown>")));
+ Progress progress(
+ "Locating external symbol file",
+ module_spec.GetFileSpec().GetFilename().AsCString("<Unknown>"));
FileSpecList debug_file_search_paths = default_search_paths;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 797df8c098af..6f5ff105477b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -7168,6 +7168,9 @@ TypeSystemClang::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
case clang::TemplateArgument::Pack:
return eTemplateArgumentKindPack;
+
+ case clang::TemplateArgument::StructuralValue:
+ return eTemplateArgumentKindStructuralValue;
}
llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
}
@@ -8353,7 +8356,7 @@ clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType(
if (name && name[0])
enumerator_decl->setDeclName(&getASTContext().Idents.get(name));
enumerator_decl->setType(clang::QualType(enutype, 0));
- enumerator_decl->setInitVal(value);
+ enumerator_decl->setInitVal(getASTContext(), value);
SetMemberOwningModule(enumerator_decl, enutype->getDecl());
if (!enumerator_decl)