Difference between revisions of "Debugging with GT.M"

From VistApedia
Jump to: navigation, search
Line 18: Line 18:
 
       150373850,SubName+3^MyFunct,%GTM-E-UNDEF, Undefined local variable: Jxack
 
       150373850,SubName+3^MyFunct,%GTM-E-UNDEF, Undefined local variable: Jxack
  
  $ZMESSAGE(x)
+
* $ZMESSAGE(x)
 
     This will give a text message for a given error number.
 
     This will give a text message for a given error number.
 
     Example: To get details about the error number, 150373850, given above...
 
     Example: To get details about the error number, 150373850, given above...
Line 24: Line 24:
 
       %GTM-E-UNDEF, Undefined local variable: !AD
 
       %GTM-E-UNDEF, Undefined local variable: !AD
  
  ZPRINT x  (e.g. ZPRINT SubName+3^MyFunct)
+
* ZPRINT x  (e.g. ZPRINT SubName+3^MyFunct)
 
     This will display the line that cause the program exception.
 
     This will display the line that cause the program exception.
 
     The 'x' may be obtained from $ZSTATUS, or from $ZPOS (see below)
 
     The 'x' may be obtained from $ZSTATUS, or from $ZPOS (see below)
  
  $ZPOSITION (OR $ZPOS)
+
* $ZPOSITION (OR $ZPOS)
 
     Shows the current position of the current line of execution  
 
     Shows the current position of the current line of execution  
 
   (or the last line exececuted in case of an error)
 
   (or the last line exececuted in case of an error)
  
  ZWRITE
+
* ZWRITE
 
     Shows the entire variable table, displaying all defined variables.
 
     Shows the entire variable table, displaying all defined variables.
  
  ZBREAK address
+
* ZBREAK address
 
     Toggles a break point at address
 
     Toggles a break point at address
 
     It is possible to have the breakpoint execute code, and then resume.  See manual.
 
     It is possible to have the breakpoint execute code, and then resume.  See manual.
  
  ZSTEP x
+
* ZSTEP x
 
     Will execute the program one line at a time.  I think this would be typically
 
     Will execute the program one line at a time.  I think this would be typically
 
     used after a ZBREAK drops command back to GT.M> prompt.
 
     used after a ZBREAK drops command back to GT.M> prompt.
Line 48: Line 48:
 
       ZSTEP OUTOF -- ??
 
       ZSTEP OUTOF -- ??
  
  ZCONTINUE
+
* ZCONTINUE
 
     Continue execution from break point.
 
     Continue execution from break point.

Revision as of 02:17, 24 March 2005

This information is from the GT.M Programmer's Manual. I'll just summarize a few points.


  • $ECODE
   This is a list of past errors, separated by commas. 
   Subsequent errors are added to the end of the list.
   Example:
     GTM>w $ECODE
     ,M6,Z150373850, 
   Errors beginning with: "M" are standard errors
                          "U" are user errors
                          "Z" are GT.M errors
  • $ZSTATUS
   This is detail about the most recent error.
   Example:
     GTM>w $ZSTATUS
     150373850,SubName+3^MyFunct,%GTM-E-UNDEF, Undefined local variable: Jxack
  • $ZMESSAGE(x)
   This will give a text message for a given error number.
   Example: To get details about the error number, 150373850, given above...
     GTM>w $ZMESSAGE(150373850)
     %GTM-E-UNDEF, Undefined local variable: !AD
  • ZPRINT x (e.g. ZPRINT SubName+3^MyFunct)
   This will display the line that cause the program exception.
   The 'x' may be obtained from $ZSTATUS, or from $ZPOS (see below)
  • $ZPOSITION (OR $ZPOS)
   Shows the current position of the current line of execution 
  (or the last line exececuted in case of an error)
  • ZWRITE
   Shows the entire variable table, displaying all defined variables.
  • ZBREAK address
   Toggles a break point at address
   It is possible to have the breakpoint execute code, and then resume.  See manual.
  • ZSTEP x
   Will execute the program one line at a time.  I think this would be typically
   used after a ZBREAK drops command back to GT.M> prompt.
     ZSTEP INTO -- start execution at current execution point, and stops at
                   next line (even if that line is in a subroutine).
     ZSTEP [OVER] -- start execution at current exec. point, and stop at the 
                   next line at the same level on the invocation stack.
     ZSTEP OUTOF -- ??
  • ZCONTINUE
   Continue execution from break point.