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