[Lldb-commits] [lldb] A few updates around "transcript" (PR #92843)

via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 13:46:21 PDT 2024


================
@@ -362,6 +363,36 @@ llvm::json::Value DebuggerStats::ReportStatistics(
     global_stats.try_emplace("modules", std::move(json_modules));
     global_stats.try_emplace("memory", std::move(json_memory));
     global_stats.try_emplace("commands", std::move(cmd_stats));
+
+    // When transcript is available, add it to the to-be-returned statistics.
+    //
+    // NOTE:
+    // When the statistics is polled by an LLDB command:
+    // - The transcript in the returned statistics *will NOT* contain the
+    //   returned statistics itself.
+    // - The returned statistics *will* be written to the internal transcript
+    //   buffer as the output of the said LLDB command. It *will* appear in
+    //   the next statistcs or transcript poll.
+    //
+    // For example, let's say the following commands are run in order:
+    // - "version"
+    // - "statistics dump"  <- call it "A"
+    // - "statistics dump"  <- call it "B"
+    // The output of "A" will contain the transcript of "version" and
+    // "statistics dump" (A), with the latter having empty output. The output
+    // of B will contain the trascnript of "version", "statistics dump" (A),
+    // "statistics dump" (B), with A's output populated and B's output empty.
----------------
royitaqi wrote:

I feel the quoted behavior is a bit difficult to understand/reason.

--

A (cleaner) alternative behavior might to completely remove the output of "statistics dump" commands in the "transcript" in the "statistics dump":
```
(lldb) statistics dump
{
  ...,
  "transcript" : [
    {
      "command": "version",
      "output": "Meta LLDB version ...",
      ...
    },
    {
      "command": "statistics dump",
      "output": "(wiped empty)",
    },
  ]
}
```

--

@clayborg  Which behavior do you think is better?

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


More information about the lldb-commits mailing list