|
From: MOULINIER L. (UDS) <luc...@un...> - 2013-04-12 09:03:48
|
Dear List, i'm a newbie as a valgrind user, so I apologize if my question seems naive. I'm triying to debug a package (extension) I wrote for the Tcl/Tk language. As my program is multi-threaded, a normal run of valgrind doesn't work. As suggested in the valgrind's log, I'm trying to use valgrind + gdb. Valgrind is launched with : valgrind -v --vgdb=yes --vgdb-error=0 --leak-check=full --leak-resolution=high --track-origins=yes --suppressions=gensupp.rules2 /usr/local/ActiveTcl/bin/tclsh /home/moumou/ordali/src/ordali.tcl exe ThrSco Note that : /usr/local/ActiveTcl/bin/tclsh is the Tcl interpreter /home/moumou/ordali/src/ordali.tcl is the Tcl script to give to the interpreter "exe ThrSco" is the argument to the script I lanched gdb : gdb /usr/local/ActiveTcl/bin/tclsh and then target remote | vgdb but then I can't give a "run /home/moumou/ordali/src/ordali.tcl exe ThrSco" command to gdb ! "run is not allowed using vgdb" So how do I launch gdb/vgdb with my arguments ? Or what is the correct way to debug such a program ? (My extension seems to be sensitive to multi-threading, so I don't want to run in a one-thread mode) Many thanks in advance ! Luc working under Ubuntu, valgrind 3.7.0 and gcc 4.6.3 --------------------------------- Dr. Luc Moulinier IGBMC 1, rue Laurent Fries 67 404 ILLKIRCH CDDEX |
|
From: Philippe W. <phi...@sk...> - 2013-04-14 20:47:24
|
On Fri, 2013-04-12 at 11:03 +0200, MOULINIER Luc (UDS) wrote: > As my program is multi-threaded, a normal run of valgrind doesn't work. Valgrind is able to run a multi-thread program (even if it serialises the execution, i.e. even on a multi-cpu, only one thread runs at a single time). However, if you want to debug your program when Valgrind encounters an error, then effectively you have to use GDB+vgdb. > > gdb /usr/local/ActiveTcl/bin/tclsh > and then > target remote | vgdb > > but then I can't give a "run /home/moumou/ordali/src/ordali.tcl exe ThrSco" command to gdb ! "run is not allowed using vgdb" Effectively, the GDB command "run" cannot be used with the Valgrind gdbserver : you must first launch your program using valgrind --vgdb-error=0 your_program your_program_args then connect GDB to the valgrind gdbserver using vgdb. You then use the GDB commands "continue", or "next", or "step" to allow the execution of your_program to proceed. Philippe |