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 return true;
43#else
44 result.AppendError("lldb was not built with gui support");
45 return false;
46#endif
47}
A command line argument class.
Definition: Args.h:33
CommandObjectGUI(CommandInterpreter &interpreter)
bool DoExecute(Args &args, CommandReturnObject &result) override
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
A class to manage flag bits.
Definition: Debugger.h:77
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
Definition: Debugger.cpp:1093
File & GetOutputFile()
Definition: Debugger.h:144
An abstract base class for files.
Definition: File.h:36
bool GetIsRealTerminal()
Return true if this file from a real terminal.
Definition: File.cpp:198
virtual FILE * GetStream()
Get the underlying libc stream for this file, or NULL.
Definition: File.cpp:127
bool GetIsInteractive()
Return true if this file is interactive.
Definition: File.cpp:192
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
@ eReturnStatusSuccessFinishResult