Skip to content

Commit

Permalink
[lldb/API] Add a way to check if the CommandInterpreter is interactive
Browse files Browse the repository at this point in the history
This patch adds the ability for the user to check if the command
interpreter's IOHandler is interactive.

Differential Revision: https://reviews.llvm.org/D119499

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
  • Loading branch information
medismailben committed Feb 16, 2022
1 parent 7066584 commit 7f3fc2e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lldb/bindings/interface/SBCommandInterpreter.i
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ public:
bool
HasAliasOptions ();

bool
IsInteractive ();

lldb::SBProcess
GetProcess ();

Expand Down
2 changes: 2 additions & 0 deletions lldb/include/lldb/API/SBCommandInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class SBCommandInterpreter {

bool HasAliasOptions();

bool IsInteractive();

lldb::SBProcess GetProcess();

lldb::SBDebugger GetDebugger();
Expand Down
2 changes: 2 additions & 0 deletions lldb/include/lldb/Interpreter/CommandInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ class CommandInterpreter : public Broadcaster,

FileSpec GetCurrentSourceDir();

bool IsInteractive();

protected:
friend class Debugger;

Expand Down
6 changes: 6 additions & 0 deletions lldb/source/API/SBCommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ bool SBCommandInterpreter::HasAliasOptions() {
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);

Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Interpreter/CommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3162,6 +3162,10 @@ bool CommandInterpreter::SaveTranscript(
return true;
}

bool CommandInterpreter::IsInteractive() {
return (GetIOHandler() ? GetIOHandler()->GetIsInteractive() : false);
}

FileSpec CommandInterpreter::GetCurrentSourceDir() {
if (m_command_source_dirs.empty())
return {};
Expand Down

0 comments on commit 7f3fc2e

Please sign in to comment.