[Lldb-commits] [lldb] [lldb] Fix output of `help format` (PR #190409)

via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 3 14:23:18 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Sergei Barannikov (s-barannikov)

<details>
<summary>Changes</summary>

The output currently contains
```
            "unicode32"
            'u' or "unsigned decimal"
            'p' or
            "pointer"
            "char[]"
            "int8_t[]"
```
The 'p' and "pointer" are supposed to appear on the same line. When we're about to print "pointer," we check whether it would exceed the column limit (in which case, we insert a line feed). This check only checks for spaces as separators, but in the case of `help format`, the "words" are separated by newlines. Look for them as well.

---
Full diff: https://github.com/llvm/llvm-project/pull/190409.diff


1 Files Affected:

- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index eeb1ae0ff3eb8..b1baab3272968 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -3174,7 +3174,7 @@ void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text,
   uint32_t chars_left = max_columns;
 
   auto nextWordLength = [](llvm::StringRef S) {
-    size_t pos = S.find(' ');
+    size_t pos = S.find_first_of(" \n");
     return pos == llvm::StringRef::npos ? S.size() : pos;
   };
 

``````````

</details>


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


More information about the lldb-commits mailing list