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 FileSP input_sp = debugger.GetInputFileSP();
32 FileSP output_sp = debugger.GetOutputFileSP();
33 if (input_sp->GetStream() && output_sp->GetStream() &&
34 input_sp->GetIsRealTerminal() && input_sp->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)
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
A class to manage flag bits.
Definition Debugger.h:80
lldb::FileSP GetInputFileSP()
Definition Debugger.h:136
lldb::FileSP GetOutputFileSP()
Definition Debugger.h:139
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
@ eReturnStatusSuccessFinishResult
std::shared_ptr< lldb_private::File > FileSP