mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:19:43 +00:00
[llvm-symbolizer] Add back --version and add a -v alias
The switch from llvm::cl to OptTable (D83530) dropped --version, which is needed by some users. This patch also adds a -v alias, which is available in GNU addr2line. The version dumping is similar to llvm-objcopy --version (exotic): ``` llvm-symbolizer LLVM (http://llvm.org/): LLVM version 12.0.0git Optimized build with assertions. Default target: x86_64-unknown-linux-gnu Host CPU: skylake-avx512 ``` Reviewed By: dyung, jhenderson Differential Revision: https://reviews.llvm.org/D85624
This commit is contained in:
parent
782e80f7b0
commit
d551fbf23e
@ -346,7 +346,7 @@ OPTIONS
|
||||
Line: 15
|
||||
Column: 0
|
||||
|
||||
.. option:: --version
|
||||
.. option:: --version, -v
|
||||
|
||||
Print version information for the tool.
|
||||
|
||||
|
8
test/tools/llvm-symbolizer/version.test
Normal file
8
test/tools/llvm-symbolizer/version.test
Normal file
@ -0,0 +1,8 @@
|
||||
# RUN: llvm-symbolizer --version | FileCheck %s --check-prefixes=SYMBOLIZER,COMMON
|
||||
# RUN: llvm-symbolizer -v | FileCheck %s --check-prefixes=SYMBOLIZER,COMMON
|
||||
# RUN: llvm-addr2line --version | FileCheck %s --check-prefixes=ADDR2LINE,COMMON
|
||||
# RUN: llvm-addr2line -v | FileCheck %s --check-prefixes=ADDR2LINE,COMMON
|
||||
|
||||
# SYMBOLIZER: llvm-symbolizer{{$}}
|
||||
# ADDR2LINE: llvm-addr2line{{$}}
|
||||
# COMMON: LLVM version {{.*}}
|
@ -43,6 +43,7 @@ def relativenames : F<"relativenames", "Strip the compilation directory from pat
|
||||
defm untag_addresses : B<"untag-addresses", "", "Remove memory tags from addresses before symbolization">;
|
||||
def use_native_pdb_reader : F<"use-native-pdb-reader", "Use native PDB functionality">;
|
||||
def verbose : F<"verbose", "Print verbose line info">;
|
||||
def version : F<"version", "Display the version">;
|
||||
|
||||
def : Flag<["-"], "a">, Alias<addresses>, HelpText<"Alias for --addresses">;
|
||||
def : F<"print-address", "Alias for --addresses">, Alias<addresses>;
|
||||
@ -58,6 +59,7 @@ def : Flag<["-"], "i">, Alias<inlines>, HelpText<"Alias for --inlines">;
|
||||
def : F<"inlining", "Alias for --inlines">, Alias<inlines>;
|
||||
def : Flag<["-"], "p">, Alias<pretty_print>, HelpText<"Alias for --pretty-print">;
|
||||
def : Flag<["-"], "s">, Alias<basenames>, HelpText<"Alias for --basenames">;
|
||||
def : Flag<["-"], "v">, Alias<version>, HelpText<"Alias for --version">;
|
||||
|
||||
// Compatibility aliases for old asan_symbolize.py and sanitizer binaries (before 2020-08).
|
||||
def : Flag<["--"], "inlining=true">, Alias<inlines>, HelpText<"Alias for --inlines">;
|
||||
|
@ -190,9 +190,8 @@ static void symbolizeInput(const opt::InputArgList &Args, uint64_t AdjustVMA,
|
||||
outs() << "\n";
|
||||
}
|
||||
|
||||
static void printHelp(bool IsAddr2Line, const SymbolizerOptTable &Tbl,
|
||||
static void printHelp(StringRef ToolName, const SymbolizerOptTable &Tbl,
|
||||
raw_ostream &OS) {
|
||||
StringRef ToolName = IsAddr2Line ? "llvm-addr2line" : "llvm-symbolizer";
|
||||
const char HelpText[] = " [options] addresses...";
|
||||
Tbl.PrintHelp(OS, (ToolName + HelpText).str().c_str(),
|
||||
ToolName.str().c_str());
|
||||
@ -203,6 +202,7 @@ static void printHelp(bool IsAddr2Line, const SymbolizerOptTable &Tbl,
|
||||
static opt::InputArgList parseOptions(int Argc, char *Argv[], bool IsAddr2Line,
|
||||
StringSaver &Saver,
|
||||
SymbolizerOptTable &Tbl) {
|
||||
StringRef ToolName = IsAddr2Line ? "llvm-addr2line" : "llvm-symbolizer";
|
||||
Tbl.setGroupedShortOptions(true);
|
||||
// The environment variable specifies initial options which can be overridden
|
||||
// by commnad line options.
|
||||
@ -217,7 +217,12 @@ static opt::InputArgList parseOptions(int Argc, char *Argv[], bool IsAddr2Line,
|
||||
if (HasError)
|
||||
exit(1);
|
||||
if (Args.hasArg(OPT_help)) {
|
||||
printHelp(IsAddr2Line, Tbl, outs());
|
||||
printHelp(ToolName, Tbl, outs());
|
||||
exit(0);
|
||||
}
|
||||
if (Args.hasArg(OPT_version)) {
|
||||
outs() << ToolName << '\n';
|
||||
cl::PrintVersionMessage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user