GDB remote debugging with valgrind

主宰稳场 提交于 2019-12-03 10:08:56

问题


If I remote debug using gdb I connect to the gdbserver using

target remote host:2345

If I debug memory errors with valgrind and gdb (to break on invalid memory access) I use

target remote | vgdb

(after starting

valgrind --track-origins=yes --vgdb=yes --vgdb-error=0 [binary]

on the local machine)

Can I combine the two to debug memory errors on a remote machine?

Note that I want to avoid using a login shell on the remote machine to work there.


回答1:


Can I combine the two to debug memory errors on a remote machine?

Yes: current vgdb accepts --port= argument since this commit:

r12204 | sewardj | 2011-10-22 13:38:08 -0700 (Sat, 22 Oct 2011) | 5 lines

So run vgdb --port=2345, and then (gdb) target remote host:2345 as usual.



来源:https://stackoverflow.com/questions/15227017/gdb-remote-debugging-with-valgrind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!