How to use valgrind in xterm with gdb on Linux (redhat) ?
The command open a xterm terminal, which disappears immediately.
xterm -e gdb valgrind --tool=drd --read-var-info=yes ./star &
I need it to do debugging for C++ code.
Thanks
If you really want to debug valgrind
, the procedure is:
xterm -e gdb valgrind &
xterm
, set up your breakpoints and such run --tool=drd --read-var-info=yes ./star
This should work:
xterm -e gdb --args valgrind --tool=drd --read-var-info=yes ./star &
assuming you want to debug valgrind itself (which seems unlikely, given the question).
If what you really want to do is debug ./star
, while it is running under DRD
, that used to be pretty much impossible, but became possible with recent valgrind versions, which have embedded gdbserver.
To do that, you'll want two xterms:
xterm -e valgrind --tool=drd --read-var-info=yes --vgdb-error=1 ./star &
xterm -e gdb -ex 'file ./star' -ex 'target remote | /path/to/vgdb' &
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.