LLDB  mainline
CommandObjectGUI.cpp
Go to the documentation of this file.
1 //===-- CommandObjectGUI.cpp ------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "CommandObjectGUI.h"
10 
13 #include "lldb/lldb-private.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
18 // CommandObjectGUI
19 
20 CommandObjectGUI::CommandObjectGUI(CommandInterpreter &interpreter)
21  : CommandObjectParsed(interpreter, "gui",
22  "Switch into the curses based GUI mode.", "gui") {}
23 
25 
27 #ifndef LLDB_DISABLE_CURSES
28  if (args.GetArgumentCount() == 0) {
29  Debugger &debugger = GetDebugger();
30 
31  lldb::StreamFileSP input_sp = debugger.GetInputFile();
32  if (input_sp && input_sp->GetFile().GetIsRealTerminal() &&
33  input_sp->GetFile().GetIsInteractive()) {
34  IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
35  if (io_handler_sp)
36  debugger.PushIOHandler(io_handler_sp);
38  } else {
39  result.AppendError("the gui command requires an interactive terminal.");
41  }
42  } else {
43  result.AppendError("the gui command takes no arguments.");
45  }
46  return true;
47 #else
48  result.AppendError("lldb was not build with gui support");
49  return false;
50 #endif
51 }
A class to manage flag bits.
Definition: Debugger.h:82
lldb::StreamFileSP GetInputFile()
Definition: Debugger.h:129
A command line argument class.
Definition: Args.h:32
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
Definition: Args.cpp:254
void PushIOHandler(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Definition: Debugger.cpp:1095
void void AppendError(llvm::StringRef in_string)
bool DoExecute(Args &args, CommandReturnObject &result) override
Definition: SBAddress.h:15
void SetStatus(lldb::ReturnStatus status)