diff options
author | Sean Callanan <scallanan@apple.com> | 2015-10-19 23:11:07 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2015-10-19 23:11:07 +0000 |
commit | 6681041d70e28e4563a5b04d41b75629e2492fc5 (patch) | |
tree | e75bd664994ead48d5b604acb1dd3b8af378d8cf /lldb/source/Host/common | |
parent | cc25301092534288a3b81a020c3a3095763ca1d4 (diff) | |
download | bcm5719-llvm-6681041d70e28e4563a5b04d41b75629e2492fc5.tar.gz bcm5719-llvm-6681041d70e28e4563a5b04d41b75629e2492fc5.zip |
Added the concept of a Read-Eval-Print-Loop to LLDB.
A REPL takes over the command line and typically treats input as source code.
REPLs can also do code completion. The REPL class allows its subclasses to
implement the language-specific functionality without having to know about the
IOHandler-specific internals.
Also added a PluginManager-based way of getting to a REPL given a language and
a target.
Also brought in some utility code and expression options that are useful for
REPLs, such as line offsets for expressions, ANSI terminal coloring of errors,
and a few IOHandler convenience functions.
llvm-svn: 250753
Diffstat (limited to 'lldb/source/Host/common')
-rw-r--r-- | lldb/source/Host/common/File.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index a3d7bf5940c..71a6149cd61 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -22,6 +22,8 @@ #include <sys/ioctl.h> #endif +#include "llvm/Support/Process.h" // for llvm::sys::Process::FileDescriptorHasColors() + #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" @@ -1051,7 +1053,11 @@ File::CalculateInteractiveAndTerminal () if (::ioctl (fd, TIOCGWINSZ, &window_size) == 0) { if (window_size.ws_col > 0) + { m_is_real_terminal = eLazyBoolYes; + if (llvm::sys::Process::FileDescriptorHasColors(fd)) + m_supports_colors = eLazyBoolYes; + } } } #endif @@ -1074,3 +1080,11 @@ File::GetIsRealTerminal () return m_is_real_terminal == eLazyBoolYes; } +bool +File::GetIsTerminalWithColors () +{ + if (m_supports_colors == eLazyBoolCalculate) + CalculateInteractiveAndTerminal(); + return m_supports_colors == eLazyBoolYes; +} + |