3

In gdb, I can run automatically the binary as (as per this post):

gdb -ex run /bin/true

What's the equivalent parameter for lldb?

This works:

echo run | lldb /bin/true

but I'd like to back to debugger console instead.

8

LLDB >= 3.4 has the -o / --one-line command line option that can be used to launch your program automatically:

lldb -o run /bin/true

For reference here are two relevant snippets from lldb-3.6 --help:

...
   -o 
   --one-line 
        Tells the debugger to execute this one-line lldb command
        after any file provided on the command line has been loaded.
...
  Notes:

       Multiple "-s" and "-o" options can be provided.  They will be
       processed from left to right in order, with the source files 
       and commands interleaved. 
...

And for reviewing command line options in a web browser -- here's a link to the lldb-3.4 man page.

Note that with LLDB < 3.4 (and also newer versions) you can use the -s / --source option to bootstrap commands like run -- for example:

$ echo run > autorun
$ lldb -s autorun -- /bin/echo arg1 arg2
1
  • When running using -o run instead of manually entering run in LLDB console it is not possible to interrupt the process using Ctrl-C. Is there any way to fix that? – fluidsonic Feb 15 '18 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.