lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda, labath.
Herald added a project: LLDB.
lawrence_danna added a parent revision: D68188: allow arbitrary python streams
to be converted to SBFile.
We now have valid files that will return NULL from GetStream().
libedit and the LLDB gui are the only places left that need FILE*
streams. Both are doing curses-like user interaction that only
make sense with a real terminal anyway, so there is no need to convert
them off of their use of FILE*. But we should check for null streams
before enabling these features.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68677
Files:
lldb/source/Commands/CommandObjectGUI.cpp
lldb/source/Core/IOHandler.cpp
Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -266,7 +266,8 @@
#ifndef LLDB_DISABLE_LIBEDIT
bool use_editline = false;
- use_editline = m_input_sp && m_input_sp->GetIsRealTerminal();
+ use_editline = GetInputFILE() && GetOutputFILE() && GetErrorFILE() &&
+ m_input_sp && m_input_sp->GetIsRealTerminal();
if (use_editline) {
m_editline_up.reset(new Editline(editline_name, GetInputFILE(),
Index: lldb/source/Commands/CommandObjectGUI.cpp
===================================================================
--- lldb/source/Commands/CommandObjectGUI.cpp
+++ lldb/source/Commands/CommandObjectGUI.cpp
@@ -29,7 +29,9 @@
Debugger &debugger = GetDebugger();
File &input = debugger.GetInputFile();
- if (input.GetIsRealTerminal() && input.GetIsInteractive()) {
+ File &output = debugger.GetOutputFile();
+ if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() &&
+ input.GetIsInteractive()) {
IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
if (io_handler_sp)
debugger.PushIOHandler(io_handler_sp);
Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -266,7 +266,8 @@
#ifndef LLDB_DISABLE_LIBEDIT
bool use_editline = false;
- use_editline = m_input_sp && m_input_sp->GetIsRealTerminal();
+ use_editline = GetInputFILE() && GetOutputFILE() && GetErrorFILE() &&
+ m_input_sp && m_input_sp->GetIsRealTerminal();
if (use_editline) {
m_editline_up.reset(new Editline(editline_name, GetInputFILE(),
Index: lldb/source/Commands/CommandObjectGUI.cpp
===================================================================
--- lldb/source/Commands/CommandObjectGUI.cpp
+++ lldb/source/Commands/CommandObjectGUI.cpp
@@ -29,7 +29,9 @@
Debugger &debugger = GetDebugger();
File &input = debugger.GetInputFile();
- if (input.GetIsRealTerminal() && input.GetIsInteractive()) {
+ File &output = debugger.GetOutputFile();
+ if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() &&
+ input.GetIsInteractive()) {
IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
if (io_handler_sp)
debugger.PushIOHandler(io_handler_sp);
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits