Skip to content

Commit 80bfac4

Browse files
authored
[lldb] Fix progress reporting for SymbolLocatorDebugSymbols (#79624)
This fixes two issues related to the DebugSymbols symbol locator: 1. Only the default symbol locator plugin reports progress. On Darwin, which uses the DebugSymbols framework we need to report the same progress form the corresponding SymbolLocator plugin. 2. Forceful dSYM lookups, for example when using `add-dsym`, use a different code path that currently does not report progress, which is confusing. Here the progress event can be more specific and specify its downloading a symbol file rather than just locating it as we'll always shell out to dsymForUUID or its equivalent. rdar://121629777
1 parent 33860b2 commit 80bfac4

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

lldb/source/Plugins/SymbolLocator/DebugSymbols/SymbolLocatorDebugSymbols.cpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,10 @@ std::optional<FileSpec> SymbolLocatorDebugSymbols::LocateExecutableSymbolFile(
776776
exec_fspec ? exec_fspec->GetFilename().AsCString("<NULL>") : "<NULL>",
777777
arch ? arch->GetArchitectureName() : "<NULL>", (const void *)uuid);
778778

779+
Progress progress(
780+
"Locating external symbol file",
781+
module_spec.GetFileSpec().GetFilename().AsCString("<Unknown>"));
782+
779783
FileSpec symbol_fspec;
780784
ModuleSpec dsym_module_spec;
781785
// First try and find the dSYM in the same directory as the executable or in
@@ -1045,33 +1049,28 @@ bool SymbolLocatorDebugSymbols::DownloadObjectAndSymbolFile(
10451049
if (!dsymForUUID_exe_spec)
10461050
return false;
10471051

1052+
// Create the dsymForUUID command.
10481053
const std::string dsymForUUID_exe_path = dsymForUUID_exe_spec.GetPath();
10491054
const std::string uuid_str = uuid_ptr ? uuid_ptr->GetAsString() : "";
1050-
const std::string file_path_str =
1051-
file_spec_ptr ? file_spec_ptr->GetPath() : "";
10521055

1053-
Log *log = GetLog(LLDBLog::Host);
1056+
std::string lookup_arg = uuid_str;
1057+
if (lookup_arg.empty())
1058+
lookup_arg = file_spec_ptr ? file_spec_ptr->GetPath() : "";
1059+
if (lookup_arg.empty())
1060+
return false;
10541061

1055-
// Create the dsymForUUID command.
10561062
StreamString command;
1057-
const char *copy_executable_arg = copy_executable ? "--copyExecutable " : "";
1058-
if (!uuid_str.empty()) {
1059-
command.Printf("%s --ignoreNegativeCache %s%s",
1060-
dsymForUUID_exe_path.c_str(), copy_executable_arg,
1061-
uuid_str.c_str());
1062-
LLDB_LOGF(log, "Calling %s with UUID %s to find dSYM: %s",
1063-
dsymForUUID_exe_path.c_str(), uuid_str.c_str(),
1064-
command.GetString().data());
1065-
} else if (!file_path_str.empty()) {
1066-
command.Printf("%s --ignoreNegativeCache %s%s",
1067-
dsymForUUID_exe_path.c_str(), copy_executable_arg,
1068-
file_path_str.c_str());
1069-
LLDB_LOGF(log, "Calling %s with file %s to find dSYM: %s",
1070-
dsymForUUID_exe_path.c_str(), file_path_str.c_str(),
1071-
command.GetString().data());
1072-
} else {
1073-
return false;
1074-
}
1063+
command << dsymForUUID_exe_path << " --ignoreNegativeCache ";
1064+
if (copy_executable)
1065+
command << "--copyExecutable ";
1066+
command << lookup_arg;
1067+
1068+
// Log and report progress.
1069+
Log *log = GetLog(LLDBLog::Host);
1070+
LLDB_LOG(log, "Calling {0} with {1} to find dSYM: {2}", dsymForUUID_exe_path,
1071+
lookup_arg, command.GetString());
1072+
1073+
Progress progress("Downloading symbol file", lookup_arg);
10751074

10761075
// Invoke dsymForUUID.
10771076
int exit_status = -1;

0 commit comments

Comments
 (0)