jingham created this revision.
jingham added reviewers: JDevlieghere, mib, bulbazord.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

runCmd (and expect which uses runCmd) run the command, and when that completes, 
prints the command that was run and the result.  That's problematic when the 
command crashes, since then you don't see what command was run.  It's better to 
print the command to run, then run it, then print the results.

This shouldn't change how the logs look normally, since runCmd captures the 
command result in an SBCommandResultObject and then prints it back out.  So 
there shouldn't be any output from lldb while the command is running.  The only 
time you should be able to see the difference is if the command crashes, and in 
that case the difference is you WILL see the command run.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154752

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2059,12 +2059,14 @@
         running = cmd.startswith("run") or cmd.startswith("process launch")
 
         for i in range(self.maxLaunchCount if running else 1):
-            self.ci.HandleCommand(cmd, self.res, inHistory)
-
             with recording(self, trace) as sbuf:
                 print("runCmd:", cmd, file=sbuf)
                 if not check:
                     print("check of return status not required", file=sbuf)
+
+            self.ci.HandleCommand(cmd, self.res, inHistory)
+
+            with recording(self, trace) as sbuf:
                 if self.res.Succeeded():
                     print("output:", self.res.GetOutput(), file=sbuf)
                 else:


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2059,12 +2059,14 @@
         running = cmd.startswith("run") or cmd.startswith("process launch")
 
         for i in range(self.maxLaunchCount if running else 1):
-            self.ci.HandleCommand(cmd, self.res, inHistory)
-
             with recording(self, trace) as sbuf:
                 print("runCmd:", cmd, file=sbuf)
                 if not check:
                     print("check of return status not required", file=sbuf)
+
+            self.ci.HandleCommand(cmd, self.res, inHistory)
+
+            with recording(self, trace) as sbuf:
                 if self.res.Succeeded():
                     print("output:", self.res.GetOutput(), file=sbuf)
                 else:
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to