mib created this revision. mib added reviewers: JDevlieghere, jingham. mib added a project: LLDB. mib requested review of this revision. Herald added a subscriber: lldb-commits.
This patch adds the ability for the user to check if the command interpreter's IOHandler is interactive. Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D119499 Files: lldb/bindings/interface/SBCommandInterpreter.i lldb/include/lldb/API/SBCommandInterpreter.h lldb/include/lldb/Interpreter/CommandInterpreter.h lldb/source/API/SBCommandInterpreter.cpp lldb/source/Interpreter/CommandInterpreter.cpp Index: lldb/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/source/Interpreter/CommandInterpreter.cpp +++ lldb/source/Interpreter/CommandInterpreter.cpp @@ -3157,6 +3157,10 @@ return true; } +bool CommandInterpreter::IsInteractive() { + return (GetIOHandler() ? GetIOHandler()->GetIsInteractive() : false); +} + FileSpec CommandInterpreter::GetCurrentSourceDir() { if (m_command_source_dirs.empty()) return {}; Index: lldb/source/API/SBCommandInterpreter.cpp =================================================================== --- lldb/source/API/SBCommandInterpreter.cpp +++ lldb/source/API/SBCommandInterpreter.cpp @@ -329,6 +329,12 @@ return (IsValid() ? m_opaque_ptr->HasAliasOptions() : false); } +bool SBCommandInterpreter::IsInteractive() { + LLDB_INSTRUMENT_VA(this); + + return (IsValid() ? m_opaque_ptr->IsInteractive() : false); +} + SBProcess SBCommandInterpreter::GetProcess() { LLDB_INSTRUMENT_VA(this); Index: lldb/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -605,6 +605,8 @@ FileSpec GetCurrentSourceDir(); + bool IsInteractive(); + protected: friend class Debugger; Index: lldb/include/lldb/API/SBCommandInterpreter.h =================================================================== --- lldb/include/lldb/API/SBCommandInterpreter.h +++ lldb/include/lldb/API/SBCommandInterpreter.h @@ -59,6 +59,8 @@ bool HasAliasOptions(); + bool IsInteractive(); + lldb::SBProcess GetProcess(); lldb::SBDebugger GetDebugger(); Index: lldb/bindings/interface/SBCommandInterpreter.i =================================================================== --- lldb/bindings/interface/SBCommandInterpreter.i +++ lldb/bindings/interface/SBCommandInterpreter.i @@ -125,6 +125,9 @@ bool HasAliasOptions (); + bool + IsInteractive (); + lldb::SBProcess GetProcess ();
Index: lldb/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/source/Interpreter/CommandInterpreter.cpp +++ lldb/source/Interpreter/CommandInterpreter.cpp @@ -3157,6 +3157,10 @@ return true; } +bool CommandInterpreter::IsInteractive() { + return (GetIOHandler() ? GetIOHandler()->GetIsInteractive() : false); +} + FileSpec CommandInterpreter::GetCurrentSourceDir() { if (m_command_source_dirs.empty()) return {}; Index: lldb/source/API/SBCommandInterpreter.cpp =================================================================== --- lldb/source/API/SBCommandInterpreter.cpp +++ lldb/source/API/SBCommandInterpreter.cpp @@ -329,6 +329,12 @@ return (IsValid() ? m_opaque_ptr->HasAliasOptions() : false); } +bool SBCommandInterpreter::IsInteractive() { + LLDB_INSTRUMENT_VA(this); + + return (IsValid() ? m_opaque_ptr->IsInteractive() : false); +} + SBProcess SBCommandInterpreter::GetProcess() { LLDB_INSTRUMENT_VA(this); Index: lldb/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -605,6 +605,8 @@ FileSpec GetCurrentSourceDir(); + bool IsInteractive(); + protected: friend class Debugger; Index: lldb/include/lldb/API/SBCommandInterpreter.h =================================================================== --- lldb/include/lldb/API/SBCommandInterpreter.h +++ lldb/include/lldb/API/SBCommandInterpreter.h @@ -59,6 +59,8 @@ bool HasAliasOptions(); + bool IsInteractive(); + lldb::SBProcess GetProcess(); lldb::SBDebugger GetDebugger(); Index: lldb/bindings/interface/SBCommandInterpreter.i =================================================================== --- lldb/bindings/interface/SBCommandInterpreter.i +++ lldb/bindings/interface/SBCommandInterpreter.i @@ -125,6 +125,9 @@ bool HasAliasOptions (); + bool + IsInteractive (); + lldb::SBProcess GetProcess ();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits