xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-symbolizer/Opts.td (revision 19261079b74319502c6ffa1249920079f0f69a72)
1include "llvm/Option/OptParser.td"
2
3multiclass B<string name, string help1, string help2> {
4  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
5  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
6}
7
8multiclass Eq<string name, string help> {
9  def NAME #_EQ : Joined<["--", "-"], name #"=">,
10                  HelpText<help>;
11  def : Separate<["--", "-"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
12}
13
14class F<string name, string help>: Flag<["--", "-"], name>, HelpText<help>;
15
16def addresses : F<"addresses", "Show address before line information">;
17defm adjust_vma
18    : Eq<"adjust-vma", "Add specified offset to object file addresses">,
19      MetaVarName<"<offset>">;
20def basenames : Flag<["--"], "basenames">, HelpText<"Strip directory names from paths">;
21defm debug_file_directory : Eq<"debug-file-directory", "Path to directory where to look for debug files">, MetaVarName<"<dir>">;
22defm default_arch : Eq<"default-arch", "Default architecture (for multi-arch objects)">;
23defm demangle : B<"demangle", "Demangle function names", "Don't demangle function names">;
24def functions : F<"functions", "Print function name for a given address">;
25def functions_EQ : Joined<["--"], "functions=">, HelpText<"Print function name for a given address">, Values<"none,short,linkage">;
26def help : F<"help", "Display this help">;
27defm dwp : Eq<"dwp", "Path to DWP file to be use for any split CUs">, MetaVarName<"<file>">;
28defm dsym_hint : Eq<"dsym-hint", "Path to .dSYM bundles to search for debug info for the object files">, MetaVarName<"<dir>">;
29defm fallback_debug_path : Eq<"fallback-debug-path", "Fallback path for debug binaries">, MetaVarName<"<dir>">;
30defm inlines : B<"inlines", "Print all inlined frames for a given address",
31                 "Do not print inlined frames">;
32defm obj
33    : Eq<"obj", "Path to object file to be symbolized (if not provided, "
34                "object file should be specified for each input line)">, MetaVarName<"<file>">;
35defm output_style
36    : Eq<"output-style", "Specify print style. Supported styles: LLVM, GNU">,
37      MetaVarName<"style">,
38      Values<"LLVM,GNU">;
39def pretty_print : F<"pretty-print", "Make the output more human friendly">;
40defm print_source_context_lines : Eq<"print-source-context-lines", "Print N lines of source file context">;
41def relative_address : F<"relative-address", "Interpret addresses as addresses relative to the image base">;
42def relativenames : F<"relativenames", "Strip the compilation directory from paths">;
43defm untag_addresses : B<"untag-addresses", "", "Remove memory tags from addresses before symbolization">;
44def use_dia: F<"dia", "Use the DIA library to access symbols (Windows only)">;
45def verbose : F<"verbose", "Print verbose line info">;
46def version : F<"version", "Display the version">;
47
48def : Flag<["-"], "a">, Alias<addresses>, HelpText<"Alias for --addresses">;
49def : F<"print-address", "Alias for --addresses">, Alias<addresses>;
50def : Flag<["-"], "C">, Alias<demangle>, HelpText<"Alias for --demangle">;
51def : Joined<["--"], "exe=">, Alias<obj_EQ>, HelpText<"Alias for --obj">, MetaVarName<"<file>">;
52def : Separate<["--"], "exe">, Alias<obj_EQ>, HelpText<"Alias for --obj">, MetaVarName<"<file>">;
53def : JoinedOrSeparate<["-"], "e">, Alias<obj_EQ>, HelpText<"Alias for --obj">, MetaVarName<"<file>">;
54def : Joined<["-"], "e=">, Alias<obj_EQ>, HelpText<"Alias for --obj">, MetaVarName<"<file>">;
55def : Flag<["-"], "f">, Alias<functions>, HelpText<"Alias for --functions">;
56def : Joined<["-"], "f=">, Alias<functions_EQ>, HelpText<"Alias for --functions=">;
57def : Flag<["-"], "h">, Alias<help>;
58def : Flag<["-"], "i">, Alias<inlines>, HelpText<"Alias for --inlines">;
59def : F<"inlining", "Alias for --inlines">, Alias<inlines>;
60def : Flag<["-"], "p">, Alias<pretty_print>, HelpText<"Alias for --pretty-print">;
61def : Flag<["-"], "s">, Alias<basenames>, HelpText<"Alias for --basenames">;
62def : Flag<["-"], "v">, Alias<version>, HelpText<"Alias for --version">;
63
64// Compatibility aliases for old asan_symbolize.py and sanitizer binaries (before 2020-08).
65def : Flag<["--"], "inlining=true">, Alias<inlines>, HelpText<"Alias for --inlines">;
66def : Flag<["--"], "inlining=false">, Alias<no_inlines>, HelpText<"Alias for --no-inlines">;
67// Compatibility aliases for pprof's symbolizer.
68def : Flag<["-"], "demangle=true">, Alias<demangle>, HelpText<"Alias for --demangle">;
69def : Flag<["-"], "demangle=false">, Alias<no_demangle>, HelpText<"Alias for --no-demangle">;
70// Compatibility no-op options.
71def : Flag<["--"], "use-symbol-table=true">;
72