6

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 Answer 1

7

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.

1
  • I found time now to try this: ( valgrind --track-origins=yes --vgdb=yes --vgdb-error=0 $opt_executable $opt_executable_args | tee $myprogramlog; ) & sleep 5; vgdb --port=2345 I get: listening on port 2345 ...connected. relaying data between gdb and process 4853 and then (gdb) target remote host:2345 the processes terminate .. So I can't debug with it, not even run it. Any ideas?
    – highsciguy
    Apr 16, 2013 at 13:28

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.