Skip to content

Commit 705fcd4

Browse files
authored
Revert "[lldb] Expand background symbol lookup" (#81182)
Reverts #80890
1 parent d1fdb41 commit 705fcd4

File tree

6 files changed

+12
-61
lines changed

6 files changed

+12
-61
lines changed

lldb/include/lldb/Core/ModuleList.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,6 @@ class UUID;
4747
class VariableList;
4848
struct ModuleFunctionSearchOptions;
4949

50-
static constexpr OptionEnumValueElement g_auto_download_enum_values[] = {
51-
{
52-
lldb::eSymbolDownloadOff,
53-
"off",
54-
"Disable automatically downloading symbols.",
55-
},
56-
{
57-
lldb::eSymbolDownloadBackground,
58-
"background",
59-
"Download symbols in the background for images as they appear in the "
60-
"backtrace.",
61-
},
62-
{
63-
lldb::eSymbolDownloadForeground,
64-
"foreground",
65-
"Download symbols in the foreground for images as they appear in the "
66-
"backtrace.",
67-
},
68-
};
69-
7050
class ModuleListProperties : public Properties {
7151
mutable llvm::sys::RWMutex m_symlink_paths_mutex;
7252
PathMappingList m_symlink_paths;
@@ -80,6 +60,7 @@ class ModuleListProperties : public Properties {
8060
bool SetClangModulesCachePath(const FileSpec &path);
8161
bool GetEnableExternalLookup() const;
8262
bool SetEnableExternalLookup(bool new_value);
63+
bool GetEnableBackgroundLookup() const;
8364
bool GetEnableLLDBIndexCache() const;
8465
bool SetEnableLLDBIndexCache(bool new_value);
8566
uint64_t GetLLDBIndexCacheMaxByteSize();
@@ -90,8 +71,6 @@ class ModuleListProperties : public Properties {
9071

9172
bool GetLoadSymbolOnDemand();
9273

93-
lldb::SymbolDownload GetSymbolAutoDownload() const;
94-
9574
PathMappingList GetSymlinkMappings() const;
9675
};
9776

lldb/include/lldb/lldb-enumerations.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,12 +1314,6 @@ enum class ChildCacheState {
13141314
///< re-use what we computed the last time we called Update.
13151315
};
13161316

1317-
enum SymbolDownload {
1318-
eSymbolDownloadOff = 0,
1319-
eSymbolDownloadBackground = 1,
1320-
eSymbolDownloadForeground = 2,
1321-
};
1322-
13231317
} // namespace lldb
13241318

13251319
#endif // LLDB_LLDB_ENUMERATIONS_H

lldb/source/Core/CoreProperties.td

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ let Definition = "modulelist" in {
88
def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">,
99
Global,
1010
DefaultFalse,
11-
Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">;
12-
def AutoDownload: Property<"auto-download", "Enum">,
13-
Global,
14-
DefaultEnumValue<"eSymbolDownloadOff">,
15-
EnumValues<"OptionEnumValues(g_auto_download_enum_values)">,
16-
Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">;
11+
Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">;
1712
def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">,
1813
Global,
1914
DefaultStringValue<"">,

lldb/source/Core/ModuleList.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,10 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) {
104104
return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value);
105105
}
106106

107-
SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const {
108-
// Backward compatibility alias.
109-
if (GetPropertyAtIndexAs<bool>(ePropertyEnableBackgroundLookup, false))
110-
return eSymbolDownloadBackground;
111-
112-
const uint32_t idx = ePropertyAutoDownload;
113-
return GetPropertyAtIndexAs<lldb::SymbolDownload>(
114-
idx, static_cast<lldb::SymbolDownload>(
115-
g_modulelist_properties[idx].default_uint_value));
107+
bool ModuleListProperties::GetEnableBackgroundLookup() const {
108+
const uint32_t idx = ePropertyEnableBackgroundLookup;
109+
return GetPropertyAtIndexAs<bool>(
110+
idx, g_modulelist_properties[idx].default_uint_value != 0);
116111
}
117112

118113
FileSpec ModuleListProperties::GetClangModulesCachePath() const {

lldb/source/Host/common/Host.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,6 @@ llvm::Error Host::OpenFileInExternalEditor(llvm::StringRef editor,
550550
}
551551

552552
bool Host::IsInteractiveGraphicSession() { return false; }
553-
554-
bool Host::IsNetworkLimited() { return false; }
555553
#endif
556554

557555
std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) {

lldb/source/Symbol/SymbolLocator.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include "lldb/Core/Debugger.h"
1212
#include "lldb/Core/PluginManager.h"
13-
#include "lldb/Host/Host.h"
1413

1514
#include "llvm/ADT/SmallSet.h"
1615
#include "llvm/Support/ThreadPool.h"
@@ -19,10 +18,12 @@ using namespace lldb;
1918
using namespace lldb_private;
2019

2120
void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) {
21+
if (!ModuleList::GetGlobalModuleListProperties().GetEnableBackgroundLookup())
22+
return;
23+
2224
static llvm::SmallSet<UUID, 8> g_seen_uuids;
2325
static std::mutex g_mutex;
24-
25-
auto lookup = [=]() {
26+
Debugger::GetThreadPool().async([=]() {
2627
{
2728
std::lock_guard<std::mutex> guard(g_mutex);
2829
if (g_seen_uuids.count(uuid))
@@ -35,23 +36,12 @@ void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) {
3536
module_spec.GetUUID() = uuid;
3637
if (!PluginManager::DownloadObjectAndSymbolFile(module_spec, error,
3738
/*force_lookup=*/true,
38-
/*copy_executable=*/true))
39+
/*copy_executable=*/false))
3940
return;
4041

4142
if (error.Fail())
4243
return;
4344

4445
Debugger::ReportSymbolChange(module_spec);
45-
};
46-
47-
switch (ModuleList::GetGlobalModuleListProperties().GetSymbolAutoDownload()) {
48-
case eSymbolDownloadOff:
49-
break;
50-
case eSymbolDownloadBackground:
51-
Debugger::GetThreadPool().async(lookup);
52-
break;
53-
case eSymbolDownloadForeground:
54-
lookup();
55-
break;
56-
};
46+
});
5747
}

0 commit comments

Comments
 (0)