Cannot get lldb to read file input

2019-02-01 23:15发布

问题:

I'm using lldb as a standalone debugger in OSX. I'm trying to debug a C executable, using a text file as input. 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 behaviour? 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 like:

./executable < <file>

回答1:

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.



标签: c macos stdin lldb