LLDB mainline
CommandObjectGUI.cpp
Go to the documentation of this file.
1//===-- CommandObjectGUI.cpp ----------------------------------------------===//
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
12#include "lldb/Host/Config.h"
15
16using namespace lldb;
17using namespace lldb_private;
18
19// CommandObjectGUI
20
22 : CommandObjectParsed(interpreter, "gui",
23 "Switch into the curses based GUI mode.", "gui") {}
24
26
28#if LLDB_ENABLE_CURSES
29 Debugger &debugger = GetDebugger();
30
31 File &input = debugger.GetInputFile();
32 File &output = debugger.GetOutputFile();
33 if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() &&
34 input.GetIsInteractive()) {
35 IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
36 if (io_handler_sp)
37 debugger.RunIOHandlerAsync(io_handler_sp);
39 } else {
40 result.AppendError("the gui command requires an interactive terminal.");
41 }
42#else
43 result.AppendError("lldb was not built with gui support");
44#endif
45}
A command line argument class.
Definition: Args.h:33
void DoExecute(Args &args, CommandReturnObject &result) override
CommandObjectGUI(CommandInterpreter &interpreter)
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
A class to manage flag bits.
Definition: Debugger.h:79
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
Definition: Debugger.cpp:1176
File & GetOutputFile()
Definition: Debugger.h:150
An abstract base class for files.
Definition: File.h:36
bool GetIsRealTerminal()
Return true if this file from a real terminal.
Definition: File.cpp:199
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
Definition: File.cpp:128
bool GetIsInteractive()
Return true if this file is interactive.
Definition: File.cpp:193
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
Definition: lldb-forward.h:353
@ eReturnStatusSuccessFinishResult