如何使用 gdb 进行输入重定向? [英] How to use gdb with input redirection?

查看:28
本文介绍了如何使用 gdb 进行输入重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在终端,我有:

myapp <我的文件输入

但是如果我想使用gdb,

gdb myapp <我的文件输入

它没有正确运行.

这里如何使用gdb?

解决方案

~$ gdb <executable>GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08版权所有 (C) 2011 Free Software Foundation, Inc.许可证 GPLv3+:GNU GPL 版本 3 或更高版本 <http://gnu.org/licenses/gpl.html>这是免费软件:您可以自由更改和重新分发它.在法律允许的范围内,不提供任何保证.输入显示复制"和显示保修"了解详情.这个 GDB 被配置为i686-linux-gnu".有关错误报告说明,请参阅:<http://bugs.launchpad.net/gdb-linaro/>...从/home/abhishek/maxtest 读取符号...完成.(gdb) 运行 <输入.txt

这对我有用.想知道这是否是您正在寻找的.

In the Terminal, I have:

myapp < myfileinput

But if I want to use gdb,

gdb myapp < myfileinput

It didn't run correctly.

How to use gdb here?

解决方案

~$ gdb <executable>

GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/abhishek/maxtest...done.

(gdb) run < input.txt

This is doing the trick for me. Wondering if this was what you were looking for.

这篇关于如何使用 gdb 进行输入重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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