Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux gdb管道重定向错误:(gdb)在fd 0上检测到挂断_Linux_Shell_Gdb_Pipe_Gnu - Fatal编程技术网

Linux gdb管道重定向错误:(gdb)在fd 0上检测到挂断

Linux gdb管道重定向错误:(gdb)在fd 0上检测到挂断,linux,shell,gdb,pipe,gnu,Linux,Shell,Gdb,Pipe,Gnu,救命啊,我怎么解决这个问题?我无法将命令从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 <h

救命啊,我怎么解决这个问题?我无法将命令从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
charmae@charmae-pc:~/workspace/AVT$echo“list”| gdb a.out
GNU gdb(Ubuntu/Linaro 7.3-0ubuntu2)7.3-2011.08
版权所有(C)2011免费软件基金会。
许可证GPLv3+:GNU GPL版本3或更高版本
这是自由软件:您可以自由更改和重新发布它。
在法律允许的范围内,不存在任何担保。键入“显示复制”
和“显示保修”了解详细信息。
此GDB配置为“i686 linux gnu”。
有关错误报告说明,请参阅:
...
从/home/charmae/workspace/AVT/a.out读取符号…完成。
(gdb)在fd 0上检测到挂断
在stdin上检测到错误

如果您的目标是在gdb启动时执行命令“list”,那么最简单的方法就是使用.gdbinit启动文件。例如:

$ echo list > .gdbinig $ gdb a.out $echo list>.gdbinig $gdb a.out 如果希望gdb在运行.gdbinit中列出的命令后退出,请执行以下操作:

$ echo quit >> .gdbinit $echo退出>>.gdbinit
另一种很好的方法是使用here文档将输入重定向到gdb:

gdb -quiet -nx << EndOfInput
thread apply all bt
quit
EndOfInput

gdb-quiet-nx我的目标是修复上面显示的错误。。我正在我的java程序和gdb之间做一些管道连接,我被它卡住了。如果你能保持管道畅通,gdb会很高兴的。例如,(这是一个可怕的黑客攻击),您可以执行“tail-f输入文件| gdb”,然后让jave程序写入input-file.Yey!我能够在java程序和gdb之间运行管道。进程p=Runtime.getRuntime().exec(“gdb a.out——解释器=console”);