mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 04:17:17 +08:00
Add a verbose option to the version command and include the "build configuration" in the command output. This allows users to quickly identify if their version of LLDB was built with support for xml/curl/python/lua etc. This data is already available through the SB API using SBDebugger::GetBuildConfiguration, but this makes it more discoverable. ``` (lldb) version -v lldb version 22.0.0git (git@github.com:llvm/llvm-project.git revision 21a2aac5e5456f9181384406f3b3fcad621a7076) clang revision 21a2aac5e5456f9181384406f3b3fcad621a7076 llvm revision 21a2aac5e5456f9181384406f3b3fcad621a7076 editline_wchar: yes lzma: yes curses: yes editline: yes fbsdvmcore: yes xml: yes lua: yes python: yes targets: [AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, LoongArch, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SPIRV, SystemZ, VE, WebAssembly, X86, XCore] curl: yes ``` Resolves #170727
67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
//===-- CommandObjectVersion.h ----------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTVERSION_H
|
|
#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTVERSION_H
|
|
|
|
#include "lldb/Host/OptionParser.h"
|
|
#include "lldb/Interpreter/CommandObject.h"
|
|
#include "lldb/Interpreter/Options.h"
|
|
|
|
namespace lldb_private {
|
|
|
|
class CommandObjectVersion : public CommandObjectParsed {
|
|
public:
|
|
CommandObjectVersion(CommandInterpreter &interpreter);
|
|
|
|
~CommandObjectVersion() override;
|
|
|
|
class CommandOptions : public Options {
|
|
public:
|
|
CommandOptions() = default;
|
|
|
|
~CommandOptions() override = default;
|
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
ExecutionContext *execution_context) override {
|
|
Status error;
|
|
const int short_option = m_getopt_table[option_idx].val;
|
|
|
|
switch (short_option) {
|
|
case 'v':
|
|
verbose = true;
|
|
break;
|
|
default:
|
|
llvm_unreachable("Unimplemented option");
|
|
}
|
|
|
|
return error;
|
|
}
|
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
|
verbose = false;
|
|
}
|
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
|
|
|
|
bool verbose;
|
|
};
|
|
|
|
Options *GetOptions() override { return &m_options; }
|
|
|
|
protected:
|
|
void DoExecute(Args &args, CommandReturnObject &result) override;
|
|
|
|
private:
|
|
CommandOptions m_options;
|
|
};
|
|
|
|
} // namespace lldb_private
|
|
|
|
#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTVERSION_H
|