Difference between revisions of "Debugging with GT.M"

From VistApedia
Jump to: navigation, search
Line 5: Line 5:
 
     This is a list of past errors, separated by commas.  
 
     This is a list of past errors, separated by commas.  
 
     Subsequent errors are added to the end of the list.
 
     Subsequent errors are added to the end of the list.
     example:
+
     Example:
 
       GTM>w $ECODE
 
       GTM>w $ECODE
 
       ,M6,Z150373850,  
 
       ,M6,Z150373850,  
Line 14: Line 14:
 
   $ZSTATUS
 
   $ZSTATUS
 
     This is detail about the most recent error.
 
     This is detail about the most recent error.
     example:
+
     Example:
 
       GTM>w $ZSTATUS
 
       GTM>w $ZSTATUS
 
       150373850,SubName+3^MyFunct,%GTM-E-UNDEF, Undefined local variable: Jxack
 
       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.

Revision as of 21:24, 23 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.