按任意键后gdb始终退出

时间:2016-12-16 07:59:01

标签: gdb exit

我检查了gdb源代码并使用MinGW成功编译。当我运行输出文件gdb.exe时,我无法输入任何内容,任何按键都会导致它退出:

aj@TERRAN E:\
$ gdb --data-directory=E:\gdb_build\gdb\gdb-7.11\gdb\data-directory
GNU gdb (GDB) 7.11
Copyright (C) 2016 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 "--host=i686-pc-mingw32 --target=arm-linux-androideabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) quit

aj@TERRAN E:\
$

我没有输入最后一个quit,我只是点击了space然后退出了。 我下载了另一个预编译的gdb,它工作正常,但它不支持python,所以我需要自己构建它。

但是我用gdb -tui尝试了tui模式,它运行正常,我可以输入命令。 为什么非tui模式退出?

2 个答案:

答案 0 :(得分:0)

这是gdb 7.12的一个错误,7.11.1工作正常。

答案 1 :(得分:0)

从Windows上的源代码构建旧版GDB时,会出现此错误。使用MSYS2构建的自定义GDB 7.6.1遇到了这个问题。 当GDB与ncurses库链接时,出现问题。在这种情况下,由于没有curses窗口,因此函数getch()从ncurses中获取并返回EOF。从readline/input.c:rl_getc()调用。
最新的资源已修复此问题,并从标准库中调用_getch()。此简单修补程序以backspace键结尾,不删除字符。因此,readline中还有更多修复程序可以修复该问题。 更多信息:https://www.mail-archive.com/bug-readline@gnu.org/msg01203.html
https://gdb-patches.sourceware.narkive.com/A7CT0KH0/enabled-tui-mode-on-msys2

构建旧版本的一种简单解决方法是使用--disable-tui configure选项禁用TUI模式。这将构建没有ncurses依赖项的GDB,并且不会暴露此错误。