brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 8630171 Raw
46 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "CommandObjectGUI.h"10 11#include "lldb/Core/IOHandlerCursesGUI.h"12#include "lldb/Host/Config.h"13#include "lldb/Interpreter/CommandInterpreter.h"14#include "lldb/Interpreter/CommandReturnObject.h"15 16using namespace lldb;17using namespace lldb_private;18 19// CommandObjectGUI20 21CommandObjectGUI::CommandObjectGUI(CommandInterpreter &interpreter)22    : CommandObjectParsed(interpreter, "gui",23                          "Switch into the curses based GUI mode.", "gui") {}24 25CommandObjectGUI::~CommandObjectGUI() = default;26 27void CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) {28#if LLDB_ENABLE_CURSES29  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);38    result.SetStatus(eReturnStatusSuccessFinishResult);39  } else {40    result.AppendError("the gui command requires an interactive terminal.");41  }42#else43  result.AppendError("lldb was not built with gui support");44#endif45}46