[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / source / Commands / CommandObjectGUI.cpp
blob762163b2670af7ad318e3f667a67eea6e44124d9
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 //===----------------------------------------------------------------------===//
9 #include "CommandObjectGUI.h"
11 #include "lldb/Core/IOHandlerCursesGUI.h"
12 #include "lldb/Host/Config.h"
13 #include "lldb/Interpreter/CommandInterpreter.h"
14 #include "lldb/Interpreter/CommandReturnObject.h"
16 using namespace lldb;
17 using namespace lldb_private;
19 // CommandObjectGUI
21 CommandObjectGUI::CommandObjectGUI(CommandInterpreter &interpreter)
22 : CommandObjectParsed(interpreter, "gui",
23 "Switch into the curses based GUI mode.", "gui") {}
25 CommandObjectGUI::~CommandObjectGUI() {}
27 bool CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) {
28 #if LLDB_ENABLE_CURSES
29 if (args.GetArgumentCount() == 0) {
30 Debugger &debugger = GetDebugger();
32 File &input = debugger.GetInputFile();
33 File &output = debugger.GetOutputFile();
34 if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() &&
35 input.GetIsInteractive()) {
36 IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
37 if (io_handler_sp)
38 debugger.RunIOHandlerAsync(io_handler_sp);
39 result.SetStatus(eReturnStatusSuccessFinishResult);
40 } else {
41 result.AppendError("the gui command requires an interactive terminal.");
42 result.SetStatus(eReturnStatusFailed);
44 } else {
45 result.AppendError("the gui command takes no arguments.");
46 result.SetStatus(eReturnStatusFailed);
48 return true;
49 #else
50 result.AppendError("lldb was not build with gui support");
51 return false;
52 #endif