[Lldb-commits] [lldb] ed32d85 - [lldb] Use async output & error stream for EvaluateExpression

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 14 22:11:12 PST 2025


Author: Jonas Devlieghere
Date: 2025-02-14T22:11:03-08:00
New Revision: ed32d85d31999756602a7d5c4647cb6771d8f857

URL: https://github.com/llvm/llvm-project/commit/ed32d85d31999756602a7d5c4647cb6771d8f857
DIFF: https://github.com/llvm/llvm-project/commit/ed32d85d31999756602a7d5c4647cb6771d8f857.diff

LOG: [lldb] Use async output & error stream for EvaluateExpression

Similar to #126821, in support of #126630.

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectExpression.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 13491b5c79442..7e26381c92405 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -500,19 +500,17 @@ 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();
+  StreamSP output_stream =
+      GetCommandInterpreter().GetDebugger().GetAsyncOutputStream();
+  StreamSP error_stream =
+      GetCommandInterpreter().GetDebugger().GetAsyncErrorStream();
 
   CommandReturnObject return_obj(
       GetCommandInterpreter().GetDebugger().GetUseColor());
-  EvaluateExpression(line.c_str(), *output_sp, *error_sp, return_obj);
+  EvaluateExpression(line.c_str(), *output_stream, *error_stream, return_obj);
 
-  if (output_sp)
-    output_sp->Flush();
-  if (error_sp) {
-    *error_sp << return_obj.GetErrorString();
-    error_sp->Flush();
-  }
+  output_stream->Flush();
+  *error_stream << return_obj.GetErrorString();
 }
 
 bool CommandObjectExpression::IOHandlerIsInputComplete(IOHandler &io_handler,


        


More information about the lldb-commits mailing list