1include "llvm/Option/OptParser.td"
2
3class F<string name>: Flag<["--", "-"], name>;
4class S<string name>: Separate<["--", "-"], name>;
5class R<list<string> prefixes, string name>
6  : Option<prefixes, name, KIND_REMAINING_ARGS>;
7
8// Please keep this in sync with the man page in docs/man/lldb.rst
9
10// Attaching options.
11def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
12
13def attach_name: Separate<["--", "-"], "attach-name">,
14  MetaVarName<"<name>">,
15  HelpText<"Tells the debugger to attach to a process with the given name.">,
16  Group<grp_attach>;
17def: Separate<["-"], "n">,
18  Alias<attach_name>,
19  HelpText<"Alias for --attach-name">,
20  Group<grp_attach>;
21
22def wait_for: F<"wait-for">,
23  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">,
24  Group<grp_attach>;
25def: Flag<["-"], "w">,
26  Alias<wait_for>,
27  HelpText<"Alias for --wait-for">,
28  Group<grp_attach>;
29
30def attach_pid: Separate<["--", "-"], "attach-pid">,
31  MetaVarName<"<pid>">,
32  HelpText<"Tells the debugger to attach to a process with the given pid.">,
33  Group<grp_attach>;
34def: Separate<["-"], "p">,
35  Alias<attach_pid>,
36  HelpText<"Alias for --attach-pid">,
37  Group<grp_attach>;
38
39
40// Scripting options.
41def grp_scripting : OptionGroup<"scripting">, HelpText<"SCRIPTING">;
42
43def python_path: F<"python-path">,
44  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">,
45  Group<grp_scripting>;
46def: Flag<["-"], "P">,
47  Alias<python_path>,
48  HelpText<"Alias for --python-path">,
49  Group<grp_scripting>;
50
51def print_script_interpreter_info: F<"print-script-interpreter-info">,
52  HelpText<"Prints out a json dictionary with information about the scripting language interpreter.">,
53  Group<grp_scripting>;
54
55def script_language: Separate<["--", "-"], "script-language">,
56  MetaVarName<"<language>">,
57  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
58  Group<grp_scripting>;
59def: Separate<["-"], "l">,
60  Alias<script_language>,
61  HelpText<"Alias for --script-language">,
62  Group<grp_scripting>;
63
64// Repl options.
65def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
66
67def repl: Flag<["--", "-"], "repl">,
68  HelpText<"Runs lldb in REPL mode with a stub process.">,
69  Group<grp_repl>;
70def: Flag<["-"], "r">,
71  Alias<repl>,
72  HelpText<"Alias for --repl">,
73  Group<grp_repl>;
74def repl_: Joined<["--", "-"], "repl=">,
75  MetaVarName<"<flags>">,
76  HelpText<"Runs lldb in REPL mode with a stub process with the given flags.">,
77  Group<grp_repl>;
78def: Joined<["-"], "r=">,
79  MetaVarName<"<flags>">,
80  Alias<repl_>,
81  HelpText<"Alias for --repl=<flags>">,
82  Group<grp_repl>;
83
84def repl_language: Separate<["--", "-"], "repl-language">,
85  MetaVarName<"<language>">,
86  HelpText<"Chooses the language for the REPL.">,
87  Group<grp_repl>;
88def: Separate<["-"], "R">,
89  Alias<repl_language>,
90  HelpText<"Alias for --repl-language">,
91  Group<grp_repl>;
92
93
94// Command options.
95def grp_command : OptionGroup<"command">, HelpText<"COMMANDS">;
96
97def no_lldbinit: F<"no-lldbinit">,
98  HelpText<"Do not automatically parse any '.lldbinit' files.">,
99  Group<grp_command>;
100def: Flag<["-"], "x">,
101  Alias<no_lldbinit>,
102  HelpText<"Alias for --no-lldbinit">,
103  Group<grp_command>;
104def local_lldbinit: F<"local-lldbinit">,
105  HelpText<"Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.">,
106  Group<grp_command>;
107
108def batch: F<"batch">,
109  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">,
110  Group<grp_command>;
111def: Flag<["-"], "b">,
112  Alias<batch>,
113  HelpText<"Alias for --batch">,
114  Group<grp_command>;
115
116def source_quietly: F<"source-quietly">,
117  HelpText<"Tells the debugger not to echo commands while sourcing files or one-line commands provided on the command line.">,
118  Group<grp_command>;
119def: Flag<["-"], "Q">,
120  Alias<source_quietly>,
121  HelpText<"Alias for --source-quietly">,
122  Group<grp_command>;
123
124def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
125  MetaVarName<"<command>">,
126  HelpText<"When in batch mode, tells the debugger to run this one-line lldb command if the target crashes.">,
127  Group<grp_command>;
128def: Separate<["-"], "k">,
129  Alias<one_line_on_crash>,
130  HelpText<"Alias for --one-line-on-crash">,
131  Group<grp_command>;
132
133def source_on_crash: Separate<["--", "-"], "source-on-crash">,
134  MetaVarName<"<file>">,
135  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
136  Group<grp_command>;
137def: Separate<["-"], "K">,
138  Alias<source_on_crash>,
139  HelpText<"Alias for --source-on-crash">,
140  Group<grp_command>;
141
142def source: Separate<["--", "-"], "source">,
143  MetaVarName<"<file>">,
144  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.">,
145  Group<grp_command>;
146def: Separate<["-"], "s">,
147  Alias<source>,
148  HelpText<"Alias for --source">,
149  Group<grp_command>;
150
151def source_before_file: Separate<["--", "-"], "source-before-file">,
152  MetaVarName<"<file>">,
153  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.">,
154  Group<grp_command>;
155def: Separate<["-"], "S">,
156  Alias<source_before_file>,
157  HelpText<"Alias for --source-before-file">,
158  Group<grp_command>;
159
160def one_line: Separate<["--", "-"], "one-line">,
161  MetaVarName<"<command>">,
162  HelpText<"Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.">,
163  Group<grp_command>;
164def: Separate<["-"], "o">,
165  Alias<one_line>,
166  HelpText<"Alias for --one-line">,
167  Group<grp_command>;
168
169def one_line_before_file: Separate<["--", "-"], "one-line-before-file">,
170  MetaVarName<"<command>">,
171  HelpText<"Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.">,
172  Group<grp_command>;
173def: Separate<["-"], "O">,
174  Alias<one_line_before_file>,
175  HelpText<"Alias for --one-line-before-file">,
176  Group<grp_command>;
177
178
179// General options.
180def version: F<"version">,
181  HelpText<"Prints out the current version number of the LLDB debugger.">;
182def: Flag<["-"], "v">,
183  Alias<version>,
184  HelpText<"Alias for --version">;
185
186def help: F<"help">,
187  HelpText<"Prints out the usage information for the LLDB debugger.">;
188def: Flag<["-"], "h">,
189  Alias<help>,
190  HelpText<"Alias for --help">;
191
192def core: Separate<["--", "-"], "core">,
193  MetaVarName<"<filename>">,
194  HelpText<"Tells the debugger to use the full path to <filename> as the core file.">;
195def: Separate<["-"], "c">,
196  Alias<core>,
197  HelpText<"Alias for --core">;
198
199def editor: F<"editor">,
200  HelpText<"Tells the debugger to open source files using the host's \"external editor\" mechanism.">;
201def: Flag<["-"], "e">,
202  Alias<editor>,
203  HelpText<"Alias for --editor">;
204
205def no_use_colors: F<"no-use-colors">,
206  HelpText<"Do not use colors.">;
207def: Flag<["-"], "X">,
208  Alias<no_use_colors>,
209  HelpText<"Alias for --no-use-color">;
210
211def file: Separate<["--", "-"], "file">,
212  MetaVarName<"<filename>">,
213  HelpText<"Tells the debugger to use the file <filename> as the program to be debugged.">;
214def: Separate<["-"], "f">,
215  Alias<file>,
216  HelpText<"Alias for --file">;
217
218def arch: Separate<["--", "-"], "arch">,
219  MetaVarName<"<architecture>">,
220  HelpText<"Tells the debugger to use the specified architecture when starting and running the program.">;
221def: Separate<["-"], "a">,
222  Alias<arch>,
223  HelpText<"Alias for --arch">;
224
225def debug: F<"debug">,
226  HelpText<"Tells the debugger to print out extra information for debugging itself.">;
227def: Flag<["-"], "d">,
228  Alias<debug>,
229  HelpText<"Alias for --debug">;
230
231def capture: F<"capture">,
232  HelpText<"Tells the debugger to capture a reproducer.">;
233def capture_path: Separate<["--", "-"], "capture-path">,
234  MetaVarName<"<filename>">,
235  HelpText<"Tells the debugger to use the given filename for the reproducer.">;
236def generate_on_exit: F<"reproducer-generate-on-exit">,
237  HelpText<"Generate reproducer on exit.">;
238
239def REM : R<["--"], "">;
240