Debugging in Matlab/Octave

From GHER

(Difference between revisions)
Jump to: navigation, search
Line 18: Line 18:
;dbclear: Remove a breakpoint.
;dbclear: Remove a breakpoint.
;dbstatus: List all breakpoints.
;dbstatus: List all breakpoints.
-
;dbwhere: Report the current file and line number where execution is
+
;dbwhere: Report the current file and line number where execution is stopped.
-
  stopped.
+
;dbtype: List the function where execution is currently stopped, enumerating the line numbers.
-
;dbtype: List the function where execution is currently stopped,
+
;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.  
-
  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.
;dbcont: Continue normal code execution from the debug prompt.
;dbquit: Quit debugging mode immediately and return to the main prompt.
;dbquit: Quit debugging mode immediately and return to the main prompt.

Revision as of 09:28, 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