首页 > 代码库 > 调试--gdb远程调试
调试--gdb远程调试
sudo apt-get gdb-server,
client调试时可能会出现 "--warning: Could not load vsyscall page because no executable was specified"
按下面步骤操作:
I just encountered this problem myself when I used a cross-compiled gdb (you will in general need this if your remote host has a different architecture). In this case the symbols need to be read from the binary compiled on the remote host. I figured out that the following works for me (also if the architectures on the hosts are the same):
(1) On the remote host:
#gdbserver [host]:[port] [remote-path-to-binary-from-gdbserver-workdir]
即gdbserver [host]:[port] [要调试的二进制文件全路径]
(2) and then on the local host in (cross-compiled) gdb:
shell sleep 5
#gdb
(gdb)target remote [host]:[port](gdb)symbol-file remote:[remote-path-to-binary-from-gdbserver-workdir](gdb)directory [local-root-directory-for-source-files]
注意: 本地源文件所在目录, 本地要有源文件.(gdb)continue
Replace the [*]
with your data. You can use it as a gdb script (hence the sleep
in the first line) or enter it on your gdb command line. The optional directory line tells it to add the local source directory to the search path for sources. This can be useful if you use a frontend which points you to the source code.
http://stackoverflow.com/questions/14014288/gdb-remote-debugging-cant-seem-to-find-symbols
调试--gdb远程调试