简体   繁体   English

gdb不执行文件命令

[英]gdb doesn't execute commands from file

I'd like to execute following commands during gdb start. 我想在gdb启动期间执行以下命令。 I've put them in file in my /root directory. 我将它们放在文件/ 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

Then I run 然后我跑

> gdb -x /root/gdbst.gdb

gdb is started but no command executed. gdb已启动,但未执行任何命令。
Here is what I get 这就是我得到的

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)

And

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

Doing so from gdb command prompt 在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

Runnign all these commands manually do what I want: gdb sets file and dir and connects to remote gdbserver. 运行所有这些命令来手动执行我想要的操作:gdb设置文件和目录并连接到远程gdbserver。 But why it ignores command file? 但是为什么它忽略命令文件?

Seems that problem was with remote side. 似乎问题出在远端。 gdbserver had been started, but it doesn't respond to connections as it should. gdbserver已经启动,但是它没有像应该那样响应连接。 So gdb executed commands silently, and last command doesn't connect to remote gdb, but silently. 因此,gdb会静默执行命令,而最后一个命令不会以静默方式连接到远程gdb。 Restarting gdbserver solved the problem. 重新启动gdbserver解决了该问题。 But seems that it should be restarted any time I'd like to reconnect... 但似乎应该在我想重新连接时随时重新启动...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM