Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot get lldb to read file input through redirect

Tags:

c

macos

stdin

lldb

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>
like image 610
Harald Husum Avatar asked Feb 23 '16 16:02

Harald Husum


1 Answers

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.

like image 71
Harald Husum Avatar answered Oct 23 '22 00:10

Harald Husum