[Lldb-commits] [lldb] [lldb] Add caching and _NT_SYMBOL_PATH parsing in SymbolLocatorSymStore (PR #191782)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 13 04:50:33 PDT 2026
================
@@ -0,0 +1,108 @@
+//===-- SymbolsTest.cpp ---------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.h"
+
+using namespace lldb_private;
+using LookupEntry = SymbolLocatorSymStore::LookupEntry;
+
+TEST(SymStoreTest, ParseEnvSymbolPaths_Srv) {
+ auto check = [](const char *str) {
+ std::vector<std::string> sources;
+ for (LookupEntry entry : SymbolLocatorSymStore::ParseEnvSymbolPaths(str))
+ sources.push_back(std::move(entry.source));
+ return sources;
+ };
+ auto returns = [](auto... strs) { return std::vector<std::string>{strs...}; };
+
+ // Local paths
+ EXPECT_EQ(check(""), returns());
+ EXPECT_EQ(check("C:\\ProgramData\\Symbols"),
+ returns("C:\\ProgramData\\Symbols"));
+ EXPECT_EQ(check("C:\\symbols;\\\\buildserver\\syms;file://D:/pdb"),
+ returns("C:\\symbols", "\\\\buildserver\\syms", "file://D:/pdb"));
+
+ // Symbol servers
+ EXPECT_EQ(check("srv*https://msdl.microsoft.com/download/symbols"),
+ returns("https://msdl.microsoft.com/download/symbols"));
+ EXPECT_EQ(check("Srv*https://msdl.microsoft.com/download/symbols"),
+ returns("https://msdl.microsoft.com/download/symbols"));
+ EXPECT_EQ(check("SRV*http://localhost"), returns("http://localhost"));
+
+ // Symbol servers and local paths with caches
+ EXPECT_EQ(check("SRV*C:\\symcache*\\\\corp\\symbols"),
+ returns("\\\\corp\\symbols"));
+ EXPECT_EQ(check("D:\\sym;srv*C:\\symcache*D:\\sym"),
+ returns("D:\\sym", "D:\\sym"));
+ EXPECT_EQ(check("srv**https://symbols.mozilla.org"),
+ returns("https://symbols.mozilla.org"));
+
+ // Symbol server with custom implementation (unsupported)
+ EXPECT_EQ(check("symsrv*symsrv.dll*https://symbols.mozilla.org"), returns());
+ EXPECT_EQ(check("symsrv*symsrv.dll*C:\\symbols*https://symbols.mozilla.org"),
+ returns());
+ EXPECT_EQ(check("symsrv*https://symbols.mozilla.org;D:\\sym"),
+ returns("D:\\sym"));
+
+ // Partially invalid specs
+ EXPECT_EQ(check("srv*;;D:\\sym;SRV*"), returns("", "D:\\sym", ""));
+ EXPECT_EQ(check("srv*D:\\1*D:\\2*D:\\3;D:\\sym"), returns("D:\\sym"));
+ EXPECT_EQ(check("symsrv*D:\\1;D:\\sym"), returns("D:\\sym"));
+}
+
+TEST(SymStoreTest, ParseEnvSymbolPaths_Cache) {
----------------
Nerixyz wrote:
Can you add a test for `cache*;\\someshare` - from https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/symbol-path#cache-symbols-locally? Not sure if that's currently handled. The docs say that the debugger should use the "default symbol cache directory".
https://github.com/llvm/llvm-project/pull/191782
More information about the lldb-commits
mailing list