[Lldb-commits] [lldb] [lldb] Add `scripting extension list --instances` (PR #226043)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 6 17:59:00 PDT 2026
================
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "lldb/Interpreter/ScriptedInstanceRegistry.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Utility/AnsiTerminal.h"
+#include "lldb/Utility/Stream.h"
+
+#include "llvm/ADT/StringMap.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static bool HasArgs(const ScriptedInstanceInfo &info) {
+ return info.args_sp && info.args_sp->GetSize();
+}
+
+bool ScriptedInstanceGroup::operator<(
+ const ScriptedInstanceGroup &other) const {
+ if (class_name != other.class_name)
+ return class_name < other.class_name;
+
+ const std::string path = source_path.GetPath();
+ const std::string other_path = other.source_path.GetPath();
+ if (path != other_path)
+ return path < other_path;
+
+ return extension < other.extension;
+}
+
+std::vector<ScriptedInstanceGroup> ScriptedInstanceRegistry::GetInstanceGroups(
+ llvm::ArrayRef<ScriptedExtension> extensions) const {
+ // Unknown names map to eScriptedExtensionInvalid, the zero value.
+ llvm::StringMap<ScriptedExtension> extension_by_plugin;
+ for (uint32_t i = 0; i < PluginManager::GetNumScriptedInterfaces(); i++)
----------------
JDevlieghere wrote:
```suggestion
for (size_t i = 0; i < PluginManager::GetNumScriptedInterfaces(); i++)
```
https://github.com/llvm/llvm-project/pull/226043
More information about the lldb-commits
mailing list