General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

WAIT BREAK debugger
(Requires GHS version 16.00A or later)

Did you know GHS contains its own built-in run file debugger? It provides the major capabilities needed to debug what's going on inside complicated macro systems, such as:
  1. Setting breakpoints;
  2. Inspecting system status;
  3. Changing values to modify future behavior;
  4. Resuming macro control after the break.
This all happens using the WAIT BREAK command, which can be sprinkled throughout your run files wherever needed, then commented out or deleted after a problem has been successfully debugged. Whenever one of these WAIT BREAKs is reached, it breaks out of any executing macros or run files, providing immediate access to the GHS command prompt. From there you can explore what's going on by entering any commands you like, such as:
  1. VARIABLES by itself to see values for all variables;
  2. MESSAGE {varname} to check the value of a specific variable;
  3. any command that displays report output;
  4. EX macroname to execute a macro showing any desired debug output.
Additionally, WAIT BREAK always starts by listing the names of all macros (and non-persistent templates) that are currently active, so you can quickly figure out where the break got triggered in your macro system. For example:

Here's a pro tip: put WAIT BREAK inside its own BREAK macro, then write calls to .BREAK instead of WAIT BREAK throughout the run file you're debugging. That way you can turn off all your breaks in one shot just by commenting out WAIT BREAK inside the MACRO BREAK definition. Even better, if there's any info that you want to see on the screen at every break, just insert necessary MESSAGE commands (or whatever) before WAIT BREAK in the BREAK macro.

So how do you resume your macros after the break? As hinted in the example footer, just press the Esc key to "escape" back to the exact place where your macro system got interrupted.

Questions, comments, or requests?
Contact Creative Systems, Inc.

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

Click here for an index to this and previous COWs