[Lldb-commits] [lldb] r133076 - in /lldb/trunk/source: Commands/CommandObjectCommands.cpp Commands/CommandObjectExpression.cpp Target/ThreadPlanTracer.cpp

Caroline Tice ctice at apple.com
Wed Jun 15 12:35:17 PDT 2011


Author: ctice
Date: Wed Jun 15 14:35:17 2011
New Revision: 133076

URL: http://llvm.org/viewvc/llvm-project?rev=133076&view=rev
Log:

Replace direct uses of the Debugger's output stream with
uses of the asynchronous stream.


Modified:
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Target/ThreadPlanTracer.cpp

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=133076&r1=133075&r2=133076&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed Jun 15 14:35:17 2011
@@ -929,7 +929,11 @@
     switch (notification)
     {
         case eInputReaderActivate:
-            reader.GetDebugger().GetOutputStream().Printf("%s\n", "Enter regular expressions in the form 's/<regex>/<subst>/' and terminate with an empty line:");
+            {
+                StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream ();
+                out_stream->Printf("%s\n", "Enter regular expressions in the form 's/<regex>/<subst>/' and terminate with an empty line:");
+                out_stream->Flush();
+            }
             break;
         case eInputReaderReactivate:
             break;
@@ -951,7 +955,9 @@
                 Error error (add_regex_cmd->AppendRegexSubstitution (bytes_strref));
                 if (error.Fail())
                 {
-                    reader.GetDebugger().GetOutputStream().Printf("error: %s\n", error.AsCString());
+                    StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream();
+                    out_stream->Printf("error: %s\n", error.AsCString());
+                    out_stream->Flush();
                     add_regex_cmd->InputReaderDidCancel ();
                     reader.SetIsDone (true);
                 }
@@ -959,9 +965,13 @@
             break;
             
         case eInputReaderInterrupt:
-            reader.SetIsDone (true);
-            reader.GetDebugger().GetOutputStream().PutCString("Regular expression command creations was cancelled.\n");
-            add_regex_cmd->InputReaderDidCancel ();
+            {
+                reader.SetIsDone (true);
+                StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream();
+                out_stream->PutCString("Regular expression command creations was cancelled.\n");
+                out_stream->Flush();
+                add_regex_cmd->InputReaderDidCancel ();
+            }
             break;
             
         case eInputReaderEndOfFile:

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=133076&r1=133075&r2=133076&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Wed Jun 15 14:35:17 2011
@@ -195,11 +195,13 @@
     switch (notification)
     {
     case eInputReaderActivate:
-        reader.GetDebugger().GetOutputStream().Printf("%s\n", "Enter expressions, then terminate with an empty line to evaluate:");
+        {
+            StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream();
+            out_stream->Printf("%s\n", "Enter expressions, then terminate with an empty line to evaluate:");
+            out_stream->Flush();
+        }
         // Fall through
     case eInputReaderReactivate:
-        //if (out_fh)
-        //    reader.GetDebugger().GetOutputStream().Printf ("%3u: ", cmd_object_expr->m_expr_line_count);
         break;
 
     case eInputReaderDeactivate:
@@ -217,14 +219,16 @@
 
         if (bytes_len == 0)
             reader.SetIsDone(true);
-        //else if (out_fh && !reader->IsDone())
-        //    ::fprintf (out_fh, "%3u: ", cmd_object_expr->m_expr_line_count);
         break;
         
     case eInputReaderInterrupt:
         cmd_object_expr->m_expr_lines.clear();
         reader.SetIsDone (true);
-        reader.GetDebugger().GetOutputStream().Printf("%s\n", "Expression evaluation cancelled.");
+        {
+            StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream();
+            out_stream->Printf("%s\n", "Expression evaluation cancelled.");
+            out_stream->Flush();
+        }
         break;
         
     case eInputReaderEndOfFile:

Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=133076&r1=133075&r2=133076&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Wed Jun 15 14:35:17 2011
@@ -55,7 +55,7 @@
     if (m_stream_sp.get())
         return m_stream_sp.get();
     else
-        return &(m_thread.GetProcess().GetTarget().GetDebugger().GetOutputStream());
+        return m_thread.GetProcess().GetTarget().GetDebugger().GetAsyncOutputStream().get();
 }
 
 void 
@@ -65,8 +65,11 @@
     bool show_frame_index = false;
     bool show_fullpaths = false;
     
-    m_thread.GetStackFrameAtIndex(0)->Dump (GetLogStream(), show_frame_index, show_fullpaths);
-    GetLogStream()->Printf("\n");
+    Stream *stream = GetLogStream();
+    m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths);
+    stream->Printf("\n");
+    stream->Flush();
+    
 }
 
 bool
@@ -259,4 +262,5 @@
         }
     }
     stream->EOL();
+    stream->Flush();
 }





More information about the lldb-commits mailing list