What is the lldb equivalent of gdb's --args?
Asked Answered
T

3

35

I'm used to running gdb like so:

$ gdb --args exe --lots --of --flags -a -b -c d e
...
(gdb) r

Is there an equivalent for lldb?

Teahan answered 29/10, 2015 at 21:8 Comment(0)
T
40

Yes, it's just -- instead of --args. From the help:

lldb -v [[--] <PROGRAM-ARG-1> [<PROGRAM_ARG-2> ...]]

Thus:

$ lldb -- exe --lots --of --flags -a -b -c d e
Teahan answered 29/10, 2015 at 21:8 Comment(1)
Note that if you came here searching for "how to make lldb run my program immediately", you will want to use lldb -o run -- exe --flags. Also see this questionWillena
I
7

You can also start lldb first and use:

(lldb) settings set target.run-args 1 2 3
(lldb) run

or:

(lldb) process launch -- <args>
Imperception answered 2/8, 2017 at 9:59 Comment(2)
That was helpful!Fitzhugh
If you want to add option arguments starting with '-' you can use: settings set -- target.run-args "-d"Valaree
L
0

just run 'run arg1 arg2' in lldb

Lindon answered 2/7, 2023 at 8:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.