summaryrefslogtreecommitdiff
path: root/lldb/source/Core/IOHandler.cpp
diff options
context:
space:
mode:
authorTed Woodward <ted.woodward@codeaurora.org>2016-03-24 20:35:03 +0000
committerTed Woodward <ted.woodward@codeaurora.org>2016-03-24 20:35:03 +0000
commit1984139672f64bf1fbcabc19ed3e248f6c5ca06a (patch)
tree2d6534eec297911357aacd0293cd1592d7ac029a /lldb/source/Core/IOHandler.cpp
parent89d4318d3d125a4a8044b60b510c07f87b7cafab (diff)
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
Diffstat (limited to 'lldb/source/Core/IOHandler.cpp')
-rw-r--r--lldb/source/Core/IOHandler.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 130fa02f92d..a73fce8aa45 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -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 *stream, const char *s, size_t len)
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