Debugging in Matlab/Octave

From GHER

(Difference between revisions)
Jump to: navigation, search
Line 12: Line 12:
|| <tt>dbclear all</tt>
|| <tt>dbclear all</tt>
|| <tt>debug_on_error(0)</tt>
|| <tt>debug_on_error(0)</tt>
 +
|}
|}
 +
;dbstop: Add a breakpoint.
 +
;dbclear: Remove a breakpoint.
 +
;dbstatus: List all breakpoints.
 +
;dbwhere: Report the current file and line number where execution is
 +
  stopped.
 +
;dbtype: List the function where execution is currently stopped,
 +
  enumerating the line numbers.
 +
;dbstep, dbnext: Execute (step) one or more lines, follow execution into (step
 +
  into) a function call, or execute until the end of a function
 +
  (step out), and re-enter debug mode. Debug mode equally allows single line stepping through a function using the commands dbstep and dbnext. These differ slightly in the way they treat the next executable line if the next line itself is a function defined in an m-file. The dbnext command will execute the next line, while staying in the existing function being debugged. The dbstep command will step in to the new function.
 +
;dbcont: Continue normal code execution from the debug prompt.
 +
;dbquit: Quit debugging mode immediately and return to the main prompt.
 +
;dbstack: Print a backtrace of the execution stack.
 +
;dbup: Move up the execution stack.
 +
;dbdown: Move down the execution stack.
 +
;keyboard: Force entry into debug mode from an m-file.
see help debug in octave
see help debug in octave

Revision as of 09:27, 20 February 2013

Matlab Octave
Stop on error dbstop on error debug_on_error(1)
Disable stop on error dbclear all debug_on_error(0)
dbstop
Add a breakpoint.
dbclear
Remove a breakpoint.
dbstatus
List all breakpoints.
dbwhere
Report the current file and line number where execution is
 stopped.
dbtype
List the function where execution is currently stopped,
 enumerating the line numbers.
dbstep, dbnext
Execute (step) one or more lines, follow execution into (step
 into) a function call, or execute until the end of a function
 (step out), and re-enter debug mode. Debug mode equally allows single line stepping through a function using the commands dbstep and dbnext. These differ slightly in the way they treat the next executable line if the next line itself is a function defined in an m-file. The dbnext command will execute the next line, while staying in the existing function being debugged. The dbstep command will step in to the new function. 
dbcont
Continue normal code execution from the debug prompt.
dbquit
Quit debugging mode immediately and return to the main prompt.
dbstack
Print a backtrace of the execution stack.
dbup
Move up the execution stack.
dbdown
Move down the execution stack.
keyboard
Force entry into debug mode from an m-file.

see help debug in octave

Personal tools