1 //===-- CommandObjectGUI.cpp ------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "CommandObjectGUI.h"
14 // Other libraries and framework includes
16 #include "lldb/Interpreter/CommandInterpreter.h"
17 #include "lldb/Interpreter/CommandReturnObject.h"
18 #include "lldb/lldb-private.h"
21 using namespace lldb_private;
23 //-------------------------------------------------------------------------
25 //-------------------------------------------------------------------------
27 CommandObjectGUI::CommandObjectGUI(CommandInterpreter &interpreter)
28 : CommandObjectParsed(interpreter, "gui",
29 "Switch into the curses based GUI mode.", "gui") {}
31 CommandObjectGUI::~CommandObjectGUI() {}
33 bool CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) {
34 #ifndef LLDB_DISABLE_CURSES
35 if (args.GetArgumentCount() == 0) {
36 Debugger &debugger = m_interpreter.GetDebugger();
38 lldb::StreamFileSP input_sp = debugger.GetInputFile();
39 if (input_sp && input_sp->GetFile().GetIsRealTerminal() &&
40 input_sp->GetFile().GetIsInteractive()) {
41 IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
43 debugger.PushIOHandler(io_handler_sp);
44 result.SetStatus(eReturnStatusSuccessFinishResult);
46 result.AppendError("the gui command requires an interactive terminal.");
47 result.SetStatus(eReturnStatusFailed);
50 result.AppendError("the gui command takes no arguments.");
51 result.SetStatus(eReturnStatusFailed);
55 result.AppendError("lldb was not build with gui support");