gdb - 使用管道输入(不是参数)进行调试 [英] gdb - debugging with piped input (not arguments)
问题描述
我通常使用以下方式运行我的程序:
I typically run my program with:
perl -e 'print "A"x200' | ./vuln_prog
标准输入由 C++ 中的 gets()
函数使用.
The stdin is consumed by a gets()
function in C++.
如果这只是一个命令参数,我可以通过以下方式打开 gdb:
If this were just a command argument, I could open gdb by doing:
gdb ./vuln_prog
run $(perl -e 'print "A"x200')
但是,我的场景不是命令参数,而是输入(STDIN?).我将如何在 gdb 中调试它?我已经尝试了很多选项,但似乎没有任何效果.
However, my scenario is not a command argument, but rather input (STDIN?). How would I debug this in gdb? I've tried a bunch of options, but nothing seems to really work.
我通常只在进程上运行 gdb,当它提示用户输入时,输入它,但我不想只输入A".我想输入 x00-xff 中的所有字符,我无法输入.
I would normally just run gdb on the process, and when it prompts for user input, type it in, however I'm not wanting to type just "A". I want to type all chars from x00-xff, which I can't type.
推荐答案
gdb ./vuln_prog
run < filename_with_input
这篇关于gdb - 使用管道输入(不是参数)进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!