[Lldb-commits] [lldb] r264332 - Fix for missing prompt on Windows
Ted Woodward via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 24 13:35:04 PDT 2016
Author: ted
Date: Thu Mar 24 15:35:03 2016
New Revision: 264332
URL: http://llvm.org/viewvc/llvm-project?rev=264332&view=rev
Log:
Fix for missing prompt on Windows
Summary: On Windows (and possibly other hosts with LLDB_DISABLE_LIBEDIT defined), the (lldb) prompt won't print after async output, like from a breakpoint hit or a step. This patch forces the prompt to be printed out after async output.
Reviewers: zturner, clayborg
Subscribers: amccarth, lldb-commits
Differential Revision: http://reviews.llvm.org/D18335
Modified:
lldb/trunk/source/Core/IOHandler.cpp
Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=264332&r1=264331&r2=264332&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Thu Mar 24 15:35:03 2016
@@ -47,6 +47,10 @@
#include "lldb/Target/StackFrame.h"
#endif
+#ifdef _MSC_VER
+#include <Windows.h>
+#endif
+
using namespace lldb;
using namespace lldb_private;
@@ -773,7 +777,26 @@ IOHandlerEditline::PrintAsync (Stream *s
m_editline_ap->PrintAsync(stream, s, len);
else
#endif
+ {
+ const char *prompt = GetPrompt();
+#ifdef _MSC_VER
+ if (prompt)
+ {
+ // Back up over previous prompt using Windows API
+ CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
+ HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+ GetConsoleScreenBufferInfo(console_handle, &screen_buffer_info);
+ COORD coord = screen_buffer_info.dwCursorPosition;
+ coord.X -= strlen(prompt);
+ if (coord.X < 0)
+ coord.X = 0;
+ SetConsoleCursorPosition(console_handle, coord);
+ }
+#endif
IOHandler::PrintAsync(stream, s, len);
+ if (prompt)
+ IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt));
+ }
}
// we may want curses to be disabled for some builds
More information about the lldb-commits
mailing list