问题描述
我正在将lldb
用作OSX中的独立调试器.我正在尝试通过重定向将文本文件用作输入来调试C可执行文件. lldb
文档指定以下命令,用于将stdin更改为给定文件:
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>
使用此命令,lldb
似乎忽略了指定的文件,而是等待键盘输入.
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:如何获得lldb
来模仿带有重定向的标准终端执行,例如:
tl;dr: How do I get lldb
to imitate a standard terminal execution with a redirect like:
./executable < <file>
推荐答案
我可以按以下方式工作:
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.
这篇关于无法使lldb通过重定向读取文件输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!