cmacosstdinlldb

Cannot get lldb to read file input through redirect


I'm using lldb as a standalone debugger in OSX. I'm trying to debug a C executable, using a text file as input, by way of a redirect. The lldb documentation specifies the following command for changing stdin to a given file:

process launch -i <file>

Using this command, lldb seems to ignore the specified file, instead waiting for keyboard input.

Is this intended behavior? If so; what do I need to do to actually get the process to operate on my wanted input file?

tl;dr: How do I get lldb to imitate a standard terminal execution with a redirect like:

./executable < <file>

Solution

  • I got it to work as follows:

    lldb <executable>
    (lldb) settings set target.input-path <file>
    (lldb) process launch
    

    It solves my problem, but I don't really have an explanation for why the method in my question doesn't work.