C++: Difference between revisions
No edit summary |
No edit summary |
||
Line 29: | Line 29: | ||
(gdb) break Newton::Solve (run code) | (gdb) break Newton::Solve (run code) | ||
(gdb) set var UpdateDebug=1 (continues) | (gdb) set var UpdateDebug=1 (continues) | ||
Website for other gdb commands: [http://www.yolinux.com/TUTORIALS/GDB-Commands.html] |
Revision as of 20:39, 1 April 2011
You can't use a debugger directly on your tcl script. But you can use a debugger on flooxs as it is running, because flooxs is c++ under the hood. Below gives an example of how to use gdb, the GNU debugger. From the Unix command line, type:
$ gdb $FLXHSOME/src/flooxs.new
Gdb takes as its argument the compiled C++ executable flooxs.new. "floods" is an alias, and because it comes second on the command line it wouldn't get expanded. Aliases only expand when they get used as the first thing.
You'l then see the gdb prompt:
(gdb)
at least it looks like that on most systems.
You can then run the code with:
(gdb) run -device zerobias.tcl
or some variation of that. Anything after the run command will be passed as arguments for flooxs. flooxs.new -device is what floods is aliased to.
You probably want to set a break point in FLPS_panic.
(gdb) break FLPS_panic
Once you hit the break point, the execution will stop and put you back at the gdb prompt. From here, you can type a variety of commands:
where - it will do a stack trace and show the calling sequence. cont - continue executing step - step over a single line of code next - step over a subroutine call print var - print a variable named var list - list the code where you are list device_tcl - list the code in that subroutine (for classes, you have to do something like Node::Size) list 10,30 list line 10 to 30 in the current file
You should be able to use these to figure out what the pdb call was the created the problem.
Some other options are:
(gdb) break Newton::Solve (run code) (gdb) set var UpdateDebug=1 (continues)
Website for other gdb commands: [1]