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