gdb - 使用管道输入进行调试(不是参数) [英] gdb - debugging with piped input (not arguments)

查看:863
本文介绍了gdb - 使用管道输入进行调试(不是参数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常运行我的程序:

  perl -e'printAx200 ./vuln_prog 

stdin由 gets() c ++函数。



如果这只是一个命令参数,我可以打开gdb:

  gdb ./vuln_prog 
运行$(perl -e'printAx200)

然而,我的场景不是命令参数,而是输入(STDIN?)。我如何在gdb中调试这个?我已经尝试了一些选项,但似乎没有任何效果。



我通常会在进程中运行gdb,当它提示用户输入时,键入它在,但我不想只键入A。我想输入\x00-\xff中的所有字符,我无法输入。 gdb ./vuln_prog
运行< filename_with_input


I typically run my program with:

perl -e 'print "A"x200' | ./vuln_prog

The stdin is consumed by a gets() function in C++.

If this were just a command argument, I could open gdb by doing:

gdb ./vuln_prog
run $(perl -e 'print "A"x200')

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.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆