32

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?

Claudiu
  • 224,032
  • 165
  • 485
  • 680

3 Answers3

37

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
Claudiu
  • 224,032
  • 165
  • 485
  • 680
  • 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 question](https://reverseengineering.stackexchange.com/questions/10586/how-to-run-automatically-executable-from-cli-using-lldb) – cfstras Jun 14 '23 at 15:32
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>
0

just run 'run arg1 arg2' in lldb

Princekin
  • 696
  • 9
  • 18