When I debug long pieces of numerical code, often I want to see the function variable values if something happens, or in an specific iteration. Generally I do:
One of the ways is using Conditional Breakpoints. You can add them by right clicking on the number of the line and selecting the "Set conditional Breakpoints..."
option.
Example:
As described in the comments of this answer, if you want to set it with the command line you can use
dbstop in filename at linenumber if condition
As an example:
dbstop in banana at 6 if ii==454345433
note, that the at linenumber
and if condition
are optional.
Another useful tool of the debugger is breaking the program if there has been an error, using dbstop if error
, as show in this Q&A.
Thanks to @Dev-il for showing me this!