[Lldb-commits] [PATCH] D25137: [lldbmi] Fix prompt which can get inserted in the middle of lldb-mi output

Dawn Perchik via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 30 15:16:22 PDT 2016


dawn created this revision.
dawn added reviewers: ted, zturner, clayborg.
dawn added subscribers: amccarth, lldb-commits.
dawn set the repository for this revision to rL LLVM.

The code added in svn trunk 264332 causes "(lldb)" to be printed in the middle of program console output.   This fix restores the behavior for non-Windows platforms to before the patch.

From a C++ program with the following source:

  ...
  printf("\n#Break: Function parameters - arrays");
  printf("\n#Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 #ExpectedEval:%d", 1001);
  printf("\n#Evaluate:FuncArr(C,B) #ExpectedEval:%d", RES);
  printf("\n#Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 + 0 #ExpectedEval:%d", 0);
  printf("\n#Evaluate:ref[0] + ref[1]*10 #ExpectedEval:%d", 65);
  printf("\n#Evaluate:FuncArrRet(7,8) #ExpectedLike:deferred");
  ...

produce the following output on iOS:

  #Break: Function parameters - arrays
  #Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 #ExpectedEval:1001
  #Evaluate:FuncArr(C,B) #ExpectedEval:4321
  #Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 + 0 #ExpectedEval:0
  #Evaluate:ref[0] + ref[1]*10 #ExpectedEval:65
  #Evalua(lldb) te:FuncArrRet(7,8) #ExpectedLike:deferred
  ...

Note the "(lldb) " inserted into the program output of the 6th print statement.


Repository:
  rL LLVM

https://reviews.llvm.org/D25137

Files:
  source/Core/IOHandler.cpp


Index: source/Core/IOHandler.cpp
===================================================================
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -590,8 +590,8 @@
   else
 #endif
   {
+#ifdef _MSC_VER
     const char *prompt = GetPrompt();
-#ifdef _MSC_VER
     if (prompt) {
       // Back up over previous prompt using Windows API
       CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
@@ -605,9 +605,11 @@
     }
 #endif
     IOHandler::PrintAsync(stream, s, len);
+#ifdef _MSC_VER
     if (prompt)
       IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt,
                             strlen(prompt));
+#endif
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25137.73142.patch
Type: text/x-patch
Size: 649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160930/04db3bcd/attachment-0001.bin>


More information about the lldb-commits mailing list