Path: blob/main/contrib/llvm-project/lldb/source/Commands/CommandObjectGUI.cpp
39587 views
//===-- CommandObjectGUI.cpp ----------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "CommandObjectGUI.h"910#include "lldb/Core/IOHandlerCursesGUI.h"11#include "lldb/Host/Config.h"12#include "lldb/Interpreter/CommandInterpreter.h"13#include "lldb/Interpreter/CommandReturnObject.h"1415using namespace lldb;16using namespace lldb_private;1718// CommandObjectGUI1920CommandObjectGUI::CommandObjectGUI(CommandInterpreter &interpreter)21: CommandObjectParsed(interpreter, "gui",22"Switch into the curses based GUI mode.", "gui") {}2324CommandObjectGUI::~CommandObjectGUI() = default;2526void CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) {27#if LLDB_ENABLE_CURSES28Debugger &debugger = GetDebugger();2930File &input = debugger.GetInputFile();31File &output = debugger.GetOutputFile();32if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() &&33input.GetIsInteractive()) {34IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));35if (io_handler_sp)36debugger.RunIOHandlerAsync(io_handler_sp);37result.SetStatus(eReturnStatusSuccessFinishResult);38} else {39result.AppendError("the gui command requires an interactive terminal.");40}41#else42result.AppendError("lldb was not built with gui support");43#endif44}454647