gdb不会从文件执行命令

时间:2018-01-24 10:32:06

标签: linux gdb

我想在gdb启动期间执行以下命令。我把它们放在我/ root目录下的文件中。

> cat /root/gdbst.gdb
file /root/centos-6.3-x86_64/abc
dir /root/centos-6.3-x86_64/dir/abcdir
target extended-remote 192.168.0.180:1234

然后我跑

> gdb -x /root/gdbst.gdb

gdb已启动,但未执行任何命令 这是我得到的

root@ubuntu:~# gdb -x /root/gdbst.gdb
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
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 "x86_64-linux-gnu".
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)

并且

-rwxrwxr-x  1 root root  236 Jan 24 03:16 gdbst.gdb

从gdb命令提示符

执行此操作
(gdb) source -v /root/gdbst.gdb
+file /root/centos-6.3-x86_64/abc
+dir /root/centos-6.3-x86_64/dir/abcdir
+target extended-remote 192.168.0.180:1234

手动运行所有这些命令按我的意愿执行:gdb设置文件和目录并连接到远程gdbserver。 但为什么它会忽略命令文件?

1 个答案:

答案 0 :(得分:0)

似乎问题出在偏远方面。 gdbserver已经启动,但它没有响应连接。所以gdb以静默方式执行命令,最后一个命令不能连接到远程gdb,而是静默。 重启gdbserver解决了这个问题。 但似乎应该在我想重新连接的时候重新启动...

相关问题