Using breakpoints

From m204wiki
Revision as of 18:56, 13 December 2022 by Ekern (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If you set a breakpoint on a line on the Source Code tab (or Daemon tab), then run the program, program execution is paused just before that line is to be executed (if that line is to be executed). When you set a breakpoint:

  • Execution will be paused immediately before the execution of the line for which the breakpoint is set.
  • The line with the breakpoint is highlighted.
  • Breakpoint set is displayed in the status bar.

These subtopics follow:

Setting a single breakpoint

Setting multiple breakpoints at once

Clearing a breakpoint

Clearing all breakpoints

Hitting breakpoints

Setting a single breakpoint

To set a breakpoint on a line, you can simply double click the desired line. Alternatively, you can right click the line and select Toggle BreakPoint from the context menu:

togBreak5

Other ways to set this breakpoint are:

  • Select Toggle Breakpoint on Current Line from the Breakpoints menu.

Once a breakpoint is set, the UL> at the beginning of the source code line changes to BR>, the highlight color changes, Breakpoint set is displayed in the status bar, and the Debugger Client  is made the topmost window on the browser screen:

togBreak5b2

Only executable statements may be breakpoints: if you try to make a non-executable statement a breakpoint, the Debugger sets a breakpoint on the next executable statement below the line you selected.

You can set as many as 1000 breakpoints in a single request. Attempting to set more than the maximum is not allowed (results in an error message).

Setting multiple breakpoints at once

You can set multiple breakpoints at once, using either of two approaches:

  • With a search string, set breakpoints on all matching lines
  • With a CTRL-B keystroke (if using the default assignments), set breakpoints on executable statements that follow "*break" comment lines in the source code

Using a search string:

  1. In the Search text box, specify a search string or a regular expression (regex).
  2. Press the ALT-B key combination (if using the default assignments), or use the Breakpoints menu Breaks At option.

A breakpoint is set on each executable line in the request (from the beginning of the request) that contains a case insensitive match of the string or regex.

No Breakpoints are set in code that is not currently displayed in the Source Code page (for example, in daemons called by the current request).

Your current execution point in the request is not affected.

The mappable Client command that sets multiple breakpoints based on a search string is breaksAt.

Using CTRL-B:

When you click CTRL-B (if using the default assignments), or when you use the Breakpoints menu Breaks option, the Client scans the current request from the beginning to the end for comments beginning with the string *break. Whenever such a line is found, a breakpoint is set on the next line if it is an executable statement.

No breakpoint is set after an occurrence of *break unless the following is true:

  • *break (case not important) must be the first non-blank characters on the line.  Any other characters may follow.
  • The line immediately following the *break comment must be an executable statement.

The Client command that sets multiple breakpoints based on *break is breaks.

Clearing a breakpoint

To remove a single breakpoint, do any of the following:

  • double click the line.
  • Right click the line and select Toggle Breakpoint.
  • Select Toggle Breakpoint on Current Line from the Breakpoints menu.

As a result, the BR> indicator changes back to UL> to indicate successful removal, the highlight color changes, and Breakpoint cleared is displayed in the status box.

Clearing all breakpoints

To clear all the breakpoints that are set, click the Clear Breaks button or use the Breakpoints menu Clear All Breakpoints option.  All breakpoints get cleared, and all breakpoint indicators in the source display are changed back.

The mappable Client command that clears all breakpoints is clearBreaks.

Hitting a breakpoint

When a breakpoint is hit,  the procedure, file, and routine or method that contain the breakpoint are identified.

breakPointHit78

 

See Also:

Break method
Running to a specific procedure
Stepping out