[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

via lldb-commits lldb-commits at lists.llvm.org
Wed May 1 17:03:33 PDT 2024


================
@@ -2044,6 +2050,15 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
   m_transcript_stream << result.GetOutputData();
   m_transcript_stream << result.GetErrorData();
 
+  // Add output and error to the transcript item after splitting lines. In the
+  // future, other aspects of the command (e.g. perf) can be added, too.
+  transcript_item->AddItem(
+      "output", StructuredData::Array::SplitString(result.GetOutputData(), '\n',
+                                                   -1, false));
+  transcript_item->AddItem(
+      "error", StructuredData::Array::SplitString(result.GetErrorData(), '\n',
+                                                  -1, false));
----------------
royitaqi wrote:

The default for `keepEmpty` is `true` in `StringRef::split`, which I think make sense.
For consistency, I set the same default values in `Array::SplitString`.

However, in these call sites, we need `keepEmpty = false`.  So, sadly, no usage of the default values.

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


More information about the lldb-commits mailing list