[Lldb-commits] [lldb] r130843 - /lldb/trunk/tools/driver/IOChannel.cpp

Caroline Tice ctice at apple.com
Wed May 4 09:44:57 PDT 2011


Author: ctice
Date: Wed May  4 11:44:57 2011
New Revision: 130843

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

Minor cleanup:  When asynchronous output comes along,
back up over and delete the prompt before writing out the
asynchronous output, rather than just going to a new line.


Modified:
    lldb/trunk/tools/driver/IOChannel.cpp

Modified: lldb/trunk/tools/driver/IOChannel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.cpp?rev=130843&r1=130842&r2=130843&view=diff
==============================================================================
--- lldb/trunk/tools/driver/IOChannel.cpp (original)
+++ lldb/trunk/tools/driver/IOChannel.cpp Wed May  4 11:44:57 2011
@@ -29,6 +29,9 @@
 const char *g_default_prompt = "(lldb) ";
 PromptMap g_prompt_map;
 
+// Printing the following string causes libedit to back up to the beginning of the line & blank it out.
+const char undo_prompt_string[4] = { (char) 13, (char) 27, (char) 91, (char) 75};
+
 static const char*
 el_prompt(EditLine *el)
 {
@@ -496,7 +499,7 @@
     // Use the mutex to make sure OutWrite and ErrWrite do not interfere with each other's output.
     IOLocker locker (m_output_mutex);
     if (asynchronous)
-        ::fwrite ("\n", 1, 1, m_out_file);
+        ::fwrite (undo_prompt_string, 1, 4, m_out_file);
     ::fwrite (buffer, 1, len, m_out_file);
     if (asynchronous)
         m_driver->GetDebugger().NotifyTopInputReader (eInputReaderAsynchronousOutputWritten);
@@ -511,7 +514,7 @@
     // Use the mutex to make sure OutWrite and ErrWrite do not interfere with each other's output.
     IOLocker locker (m_output_mutex);
     if (asynchronous)
-        ::fwrite ("\n", 1, 1, m_err_file);
+        ::fwrite (undo_prompt_string, 1, 4, m_err_file);
     ::fwrite (buffer, 1, len, m_err_file);
     if (asynchronous)
         m_driver->GetDebugger().NotifyTopInputReader (eInputReaderAsynchronousOutputWritten);





More information about the lldb-commits mailing list