gdb 管道重定向错误:(gdb) 在 fd 0 上检测到挂断
帮忙,我该如何解决这个问题?我无法将命令从 stdin 重定向到 gdb。
我收到此错误:
charmae@charmae-pc:~/workspace/AVT$ echo "list" | gdb a.out
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/charmae/workspace/AVT/a.out...done.
(gdb) Hangup detected on fd 0
error detected on stdin
Help, how do i fix this? I am unable to redirect command from stdin to gdb.
I get this error:
charmae@charmae-pc:~/workspace/AVT$ echo "list" | gdb a.out
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/charmae/workspace/AVT/a.out...done.
(gdb) Hangup detected on fd 0
error detected on stdin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一种效果很好的技术是使用此处文档将输入重定向到 gdb:
这使得编写控制 gdb 的脚本而无需使用临时文件成为可能。它似乎完全避免了“检测到挂断”消息。
Another technique that works nicely is to redirect input to gdb using a here-document:
This makes it possible to write a script which controls gdb without having to use temporary files. It seems to avoid the "Hangup detected" message completely.
如果您的目标是在 gdb 启动时执行命令“list”,最简单的方法是使用 .gdbinit 启动文件。例如:
如果您希望 gdb 在运行 .gdbinit 中列出的命令后退出,请执行以下操作:
If your goal is to execute the command "list" when gdb starts up, the easiest way to do that is to use a .gdbinit startup file. For example:
If you want gdb to exit after running the commands listed in .gdbinit, do: