如何在使用gdb进行调试时将重定向传递给程序 [英] how to pass redirection to program while debugging with gdb
本文介绍了如何在使用gdb进行调试时将重定向传递给程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在linux命令行中输入以下内容:
I'm entering the following on the linux command line:
./generate 10 8 | ./find 257
我想在find命令上运行gdb,它是一个参数。你是怎样做的?
./generate 10 8 | gdb ./find 257
I would like to run gdb on the find command while piping output to it and passing it a parameter. How do you do that? ./generate 10 8 | gdb ./find 257
当然不起作用。无法想象:($ / b>
Doesn't work of course. Can't figure it out:(
推荐答案
您可以使用命名管道:
mknod /tmp/pipe p
./generate 10 8 > /tmp/pipe
gdb --args ./find 257
(gdb) run < /tmp/pipe
这篇关于如何在使用gdb进行调试时将重定向传递给程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文