[Lldb-commits] [lldb] [lldb] List registered extensions in `help scripting-extension` (PR #232891)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 16 14:52:07 PDT 2026


================
@@ -181,6 +183,30 @@ llvm::StringRef LanguageTypeHelpTextCallback() {
   return help_text;
 }
 
+llvm::StringRef ScriptedExtensionHelpTextCallback() {
+  // Rebuilt on every call so extensions registered after the first lookup
+  // still show up.
+  static std::string help_text;
+
+  llvm::SmallVector<std::pair<llvm::StringRef, llvm::StringRef>> extensions;
+  size_t longest = 0;
+  PluginManager::ForEachScriptedExtension(
+      [&](lldb::ScriptedExtension extension, llvm::StringRef description) {
+        llvm::StringRef name = ScriptInterpreter::ExtensionToString(extension);
+        longest = std::max(longest, name.size());
+        extensions.emplace_back(name, description);
+      });
+
+  StreamString sstr;
+  sstr << "The name of a scripting extension. One of the following:\n";
+  for (const auto &[name, description] : extensions)
+    sstr.Printf("  %-*s - %s\n", static_cast<int>(longest), name.data(),
----------------
bulbazord wrote:

Format instead of Printf? You have StringRefs, so we don't need to dangerously pull the `const char *` out of a StringRef or create temporary std::strings.

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


More information about the lldb-commits mailing list