1 //===-- CommandObjectVersion.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 //===----------------------------------------------------------------------===// 8 9 #include "CommandObjectVersion.h" 10 11 #include "lldb/Interpreter/CommandInterpreter.h" 12 #include "lldb/Interpreter/CommandReturnObject.h" 13 #include "lldb/lldb-private.h" 14 15 using namespace lldb; 16 using namespace lldb_private; 17 18 //------------------------------------------------------------------------- 19 // CommandObjectVersion 20 //------------------------------------------------------------------------- 21 22 CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter) 23 : CommandObjectParsed(interpreter, "version", 24 "Show the LLDB debugger version.", "version") {} 25 26 CommandObjectVersion::~CommandObjectVersion() {} 27 28 bool CommandObjectVersion::DoExecute(Args &args, CommandReturnObject &result) { 29 if (args.GetArgumentCount() == 0) { 30 result.AppendMessageWithFormat("%s\n", lldb_private::GetVersion()); 31 result.SetStatus(eReturnStatusSuccessFinishResult); 32 } else { 33 result.AppendError("the version command takes no arguments."); 34 result.SetStatus(eReturnStatusFailed); 35 } 36 return true; 37 } 38