blob: 3d05335e92e47846a0ca6ba0fac9670217a95d0d [file] [log] [blame]
Greg Clayton44d93782014-01-27 23:43:24 +00001//===-- CommandObjectGUI.cpp ------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "lldb/lldb-python.h"
11
12#include "CommandObjectGUI.h"
13
14// C Includes
15// C++ Includes
16// Other libraries and framework includes
17// Project includes
18#include "lldb/lldb-private.h"
19#include "lldb/Interpreter/CommandInterpreter.h"
20#include "lldb/Interpreter/CommandReturnObject.h"
21
22using namespace lldb;
23using namespace lldb_private;
24
25//-------------------------------------------------------------------------
26// CommandObjectGUI
27//-------------------------------------------------------------------------
28
29CommandObjectGUI::CommandObjectGUI (CommandInterpreter &interpreter) :
30 CommandObjectParsed (interpreter, "gui", "Switch into the curses based GUI mode.", "gui")
31{
32}
33
34CommandObjectGUI::~CommandObjectGUI ()
35{
36}
37
38bool
39CommandObjectGUI::DoExecute (Args& args, CommandReturnObject &result)
40{
Deepak Panickal914b8d92014-01-31 18:48:46 +000041#ifndef LLDB_DISABLE_CURSES
Greg Clayton44d93782014-01-27 23:43:24 +000042 if (args.GetArgumentCount() == 0)
43 {
44 Debugger &debugger = m_interpreter.GetDebugger();
45 IOHandlerSP io_handler_sp (new IOHandlerCursesGUI (debugger));
46 if (io_handler_sp)
47 debugger.PushIOHandler(io_handler_sp);
48 result.SetStatus (eReturnStatusSuccessFinishResult);
49 }
50 else
51 {
52 result.AppendError("the gui command takes no arguments.");
53 result.SetStatus (eReturnStatusFailed);
54 }
55 return true;
Deepak Panickal914b8d92014-01-31 18:48:46 +000056#else
57 result.AppendError("lldb was not build with gui support");
58 return false;
59#endif
Greg Clayton44d93782014-01-27 23:43:24 +000060}
61