[Lldb-commits] [lldb] [lldb] Synchronize the debugger's stdout and stderr streams (PR #126630)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 13 01:47:01 PST 2025


================
@@ -500,19 +502,16 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
 void CommandObjectExpression::IOHandlerInputComplete(IOHandler &io_handler,
                                                      std::string &line) {
   io_handler.SetIsDone(true);
-  StreamFileSP output_sp = io_handler.GetOutputStreamFileSP();
-  StreamFileSP error_sp = io_handler.GetErrorStreamFileSP();
+  LockedStreamFile locked_output_stream =
+      io_handler.GetOutputStreamFileSP()->Lock();
+  LockedStreamFile locked_error_stream =
+      io_handler.GetErrorStreamFileSP()->Lock();
----------------
labath wrote:

We probably don't want to hold this locked while the expression is being evaluated. (Although I also don't know why does this function take streams to begin with. It seems like it could just print everything into the return object).

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


More information about the lldb-commits mailing list