[Lldb-commits] [lldb] [lldb] Add ScriptedSymbolLocator plugin for source file resolution (PR #181334)

via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 13 10:21:04 PST 2026


================
@@ -0,0 +1,271 @@
+//===-- SymbolLocatorScripted.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 "SymbolLocatorScripted.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+
+#include <unordered_map>
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE(SymbolLocatorScripted)
+
+namespace {
+
+#define LLDB_PROPERTIES_symbollocatorscripted
+#include "SymbolLocatorScriptedProperties.inc"
+
+enum {
+#define LLDB_PROPERTIES_symbollocatorscripted
+#include "SymbolLocatorScriptedPropertiesEnum.inc"
+};
+
+class PluginProperties : public Properties {
+public:
+  static llvm::StringRef GetSettingName() {
+    return SymbolLocatorScripted::GetPluginNameStatic();
+  }
+
+  PluginProperties() {
+    m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
+    m_collection_sp->Initialize(g_symbollocatorscripted_properties_def);
+
+    m_collection_sp->SetValueChangedCallback(
+        ePropertyScriptClass, [this] { ScriptClassChangedCallback(); });
+  }
+
+  llvm::StringRef GetScriptClassName() const {
+    const OptionValueString *s =
+        m_collection_sp->GetPropertyAtIndexAsOptionValueString(
+            ePropertyScriptClass);
+    if (s)
+      return s->GetCurrentValueAsRef();
+    return {};
+  }
----------------
jimingham wrote:

This is a global thing in the current implementation.  I really think we need to keep a list of the targets that are holding onto a module, so that when we do module specific queries like this we could say "Oh all the targets that are using this module, do any of you have a symbol locator.  If there's just one target that does, I'll use that, if there are more than one, maybe I'll try all maybe that's an error..."
But that's outside the scope of this PR most likely.


https://github.com/llvm/llvm-project/pull/181334


More information about the lldb-commits mailing list