home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 36 Tips / 36-Tips.zip / debug.rme < prev    next >
Text File  |  1998-04-29  |  52KB  |  1,696 lines

  1. <  Using OS/2 Warp System Debugging Tools
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.   
  18.  
  19.   
  20.   
  21.  
  22.  
  23.  
  24.   July 18, 1997
  25.  
  26.   
  27.   
  28.   
  29.   
  30.   OS/2 Fix Distribution
  31.   Personal System Products
  32.   Austin, Tx
  33.   
  34.   
  35.   
  36.   
  37.   
  38.   (c) Copyright International Business Machines Corporation, 1997.
  39.   All rights Reserved.
  40.  
  41.   July 18, 1997 - Warp Debug
  42.  
  43.  
  44.  
  45.                         July 18, 1997 - Warp Debug
  46.  
  47.   CONTENTS
  48.  
  49.  
  50.     Overview ......................................................... 1
  51.     Dump Formatter ................................................... 1
  52.     Kernel Debugger .................................................. 2
  53.     System Trace Utilities ........................................... 2
  54.       TRACEGET ....................................................... 3
  55.       TRSPOOL ........................................................ 3
  56.       DTRACE ......................................................... 5
  57.       User Guide ..................................................... 5
  58.       DTRACE functions ............................................... 8
  59.       Format of the Trace Program File .............................. 11
  60.       RPN command syntax ............................................ 12
  61.     File header ..................................................... 13
  62.     Tracepoint header ............................................... 15
  63.     The Trace Program ............................................... 17
  64.     Trace Program Examples .......................................... 27
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.   
  100.                                                             Contents  ii
  101.  
  102.                         July 18, 1997 - Warp Debug
  103.  
  104.   OVERVIEW
  105.  
  106.   This README file contains information for the users of the system
  107.   debugging tools:
  108.  
  109.   ■   Dump Formatter
  110.   ■   Kernel Debugger
  111.   ■   System Trace Utilities
  112.  
  113.  
  114.  
  115.   DUMP FORMATTER
  116.  
  117.   With WARP Server SMP and Warp 4.0, each FixPak installs the
  118.   corresponding version of the Dump Formatter and related symbol files
  119.   in
  120.  
  121.   \OS2\SYSTEM\PMDF                        Warp Server SMP
  122.   \OS2\PDPSI\PMDF\WARP4                   Warp 4.0
  123.  
  124.  
  125.   If multiple versions of the Dump Formatter are required then they must
  126.   be installed in directories outside the \OS2 directory tree since the
  127.   fix installation tool will replace all versions of DF_RET.EXE and
  128.   DF_DEB.EXE if finds in the \OS2 directory tree.
  129.  
  130.   Thus, prior to installation of a FixPak the
  131.  
  132.   \OS2\SYSTEM\PMDF                        Warp Server SMP
  133.   \OS2\PDPSI\PMDF\WARP4                   Warp 4.0
  134.  
  135.  
  136.   directory should be copied if it is required for use after the FixPak
  137.   has been installed.
  138.  
  139.   When multiple versions of the Dump Formatter are used the
  140.  
  141.   \OS2\SYSTEM\PMDF\PMDFVERS.LST           Warp Server SMP
  142.   \OS2\PDPSI\PMDF\WARP4\PMDFVERS.LST      Warp 4.0
  143.  
  144.  
  145.   file should be updated to cross reference each system version with its
  146.   corresponding Dump Formatter directory location. The format of
  147.   PMDFVERS.LST entries are:
  148.  
  149.   df-path;build-level;description
  150.  
  151.  
  152.   Dump Formatters and fuller sets of symbols file for various OS/2
  153.   versions may be obtained from:
  154.  
  155.  
  156.   
  157.                                                              Overview  1
  158.  
  159.                         July 18, 1997 - Warp Debug
  160.  
  161.   ftp:\\service.boulder.ibm.com\ps\products\os2\fixes\debug
  162.  
  163.  
  164.  
  165.  
  166.   KERNEL DEBUGGER
  167.  
  168.   If the debug kernel is installed when a FixPak is installed then it
  169.   will be replaced by the retail version of new version of the kernel,
  170.   together with any symbol files are that are installed by the FixPak.
  171.   If these files are required after installation of a FixPak then they
  172.   should be copied to a private directory not on the boot drive.
  173.  
  174.   After installation of a FixPak the associated debug (ALLSTRICT and
  175.   HSTRICT) kernel and system symbol files may be obtained from:
  176.  
  177.   ftp:\\service.boulder.ibm.com\ps\products\os2\fixes\debug
  178.  
  179.  
  180.  
  181.  
  182.   SYSTEM TRACE UTILITIES
  183.  
  184.   Each FixPak installs version specific trace formatting (*.TFF) and
  185.   definition files (*.TDF) in the \OS2\SYSTEM\TRACE directory.  If users
  186.   service multiple versions of OS2 they may need to copy the *.TFF files
  187.   to a private directory in order to allow a trace taken from another
  188.   system version to format correctly.  The /T= parameter of TRACEFMT
  189.   will allow the user to specify the TFF path from the command line. The
  190.   TFF path may also be specified by selecting the File pull-down and Set
  191.   TFF path option of TRACEFMT.
  192.  
  193.   In general TFFs are changed for a given release of OS2 except for
  194.   corrective purposes. The TDFs however are dependent on being precisely
  195.   matched to the module version to which they apply. TDFs are used by
  196.   the TRACE command to apply dynamic trace points. If the debug kernel
  197.   is installed then the associated OS2KRNL.TDF must be installed if
  198.   kernel tracing is required.  The TDFs for the HSTRICT and ALLSTRICT
  199.   kernels are packaged with the dump formatter symbols as OS2KRNLB.TDF
  200.   and OS2KRNLD.TDF. These may be obtained from:
  201.  
  202.   ftp:\\service.boulder.ibm.com\ps\products\os2\fixes\debug
  203.  
  204.  
  205.   Note: With OS/2 3.0 Fix Pack 29 and OS/2 4.0 GA the combined
  206.   SYSTEM.TDF and SYSTEM.TFFs were obsoleted.  Individual TFFs and TDFs
  207.   are installed.  However SYSTEM.TFF is sill supported by the TRACEFMT
  208.   command and may be used for earlier versions of OS/2.
  209.  
  210.   Warp 3.0 FixPak 29 and Warp 4.0 GA introduce three new trace
  211.   utilities: TRACEGET, TRSPOOL and DTRACE. These are described below:
  212.  
  213.   
  214.                                                              Overview  2
  215.  
  216.                         July 18, 1997 - Warp Debug
  217.  
  218.   TRACEGET
  219.  
  220.   The TACEGET command will extract the System Trace buffer and save it
  221.   in a file. The command syntax:
  222.  
  223.          TRACEGET file
  224.  
  225.  
  226.  
  227.  
  228.   TRSPOOL
  229.  
  230.   TRSPOOL extends the usefulness of the OS/2 system trace facility by
  231.   capturing the single system trace buffer and spooling it a cyclically
  232.   used sequence of disk files.  The captured trace disk files may be
  233.   later formatted using TRACEFMT, by selecting the Open option of the
  234.   File menu.
  235.  
  236.   TRSPOOL operates by polling the system trace buffer until halted by
  237.   pressing Ctrl-C.
  238.  
  239.   The system trace buffer may be captured at regular intervals or by
  240.   "Adaptive polling".
  241.  
  242.   Adaptive polling mode attempts to capture the system trace buffer when
  243.   the system trace buffer is a certain per-centage used.  The polling
  244.   time is adjusted according to the actual usage of the last captured
  245.   buffer.  The adaptive algorithm has a built in hysteresis to avoid the
  246.   affects of short bursts of intensive tracing or moments of inactivity.
  247.   Because there is no system notification of when the trace buffer
  248.   wraps, TRSPOOL may loose trace events under very erratic system
  249.   performance.
  250.  
  251.   TRSPOOL will operate without parameter specification in adaptive
  252.   polling mode. However the following parameters may be specified:
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.   
  271.                                                              Overview  3
  272.  
  273.                         July 18, 1997 - Warp Debug
  274.  
  275.    /An Specifies the target per-centage trace buffer usage for adaptive
  276.        spooling.
  277.        Default: 30(%%). This is the default spooling method.
  278.    /Fn Specifies the number of spooled trace buffer files.
  279.        Default: 10.
  280.    /Tn Specifies fixed time trace buffer spooling, in mili-seconds,
  281.        or if specified with /A the initial sleep time.
  282.        Default: Adaptive spooling - /A option + initial sleep time
  283.        2000ms.
  284.        Note: when adaptive spooling is active, the sleep time interval
  285.        is limitated to a range between 50ms and 60000ms. Any time interval
  286.        may be specified with fixed time spooling.
  287.    /Q  Specifies quiet operation - messages are suppressed.
  288.        Default: non-quiet mode.
  289.    /W  Specifies write-through mode. Trace files are pre-allocated
  290.        and opened in write-through mode.
  291.        Default: normal file open mode.
  292.    /P  Specifies trace files should be pre-allocated.
  293.        Default: files are not pre-allocated unless /W is specified.
  294.    /?  Display help.
  295.  
  296.  
  297.   The generated trace buffer files have names: TRACEBUF.nnn, where nnn
  298.   ranges from 000 to the value specified by /Fn.
  299.  
  300.   The /W option is provided for use where tracing precedes a system
  301.   outage and there is no orderly shutdown. This disadvantage of using
  302.   this option is that writing to the TRACEBUG.nnn files is made
  303.   synchronous, consequently the time take to spool the trace buffer will
  304.   be longer.
  305.  
  306.   The /P option pre-allocates and initialises all TRACEBUF.nnn files to
  307.   nulls. This ensures that space is available on hard disk for the
  308.   requisite TRACEBUF.nnn files. In addition there is an improved chance
  309.   that data written to these files will be committed should a system
  310.   outage occur. The /P option is implied by /W.
  311.  
  312.   Note: Neither of the /P or /W options is fail-safe. If a system outage
  313.   occurs after the trace buffer has been read, but before data has been
  314.   committed to disk then it will not be recorded. However, the segment
  315.   allocated by TRSPOOL for the local copy of the trace buffer is
  316.   reported at initialisation. This may also be located from a system
  317.   dump by searching for the eye-catcher "TRSPOOL RAS DATA" in the
  318.   TRSPOOL stack segment. The trace buffer selector follows the
  319.   eye-catcher. The file number of the last file written is also recorded
  320.   as a word following the trace buffer selector.
  321.  
  322.   To use TRSPOOL, the system trace must first be enabled by specifying
  323.  
  324.      TRACEBUF=63
  325.  
  326.  
  327.   
  328.                                                              Overview  4
  329.  
  330.                         July 18, 1997 - Warp Debug
  331.  
  332.   in the CONFIG.SYS.
  333.  
  334.   The system trace is activated by using the TRACE command or TRACE=
  335.   statement of CONFIG.SYS.
  336.  
  337.  
  338.   DTRACE
  339.  
  340.   DTRACE exploits the DosDynamicTrace facility at a low-level.  This may
  341.   be used to implement ad-hoc tracing in DLLs, Device Drivers, File
  342.   System Drivers and the OS2 Kernel.  EXE files are also included.
  343.   Dynamic Trace may be used for diagnostic purposes and performance
  344.   monitoring.
  345.  
  346.   Dynamic trace is a facility available within the OS/2 kernel.
  347.   Tracepoints are implemented by modifying dynamically code of modules
  348.   loaded in memory. This is in contrast to Static tracepoints which are
  349.   implemented when applications call the DosSysTrace API.
  350.  
  351.   Dynamic tracepoints are implemented by replacing machine instructions
  352.   at specified points within a module by INT3 instructions.  This is
  353.   done by the DosDynamicTrace API.  When the INT3 instruction executes,
  354.   control is passed to the system TRAP3 exception handler, which in turn
  355.   passes control to Dynamic Trace if the TRAP3 was due to a known
  356.   tracepoint.  Dynamic Trace interprets instructions, which are in
  357.   Reverse Polish Notation, that were passed to it when the trace point
  358.   was defined.  These instructions allow data to be logged in the system
  359.   trace buffer and local variables associated with the tracepoint to be
  360.   manipulated.  After the RPN instruction stream is complete, the
  361.   original instruction is single-stepped then normal execution resumed.
  362.  
  363.   The overhead of dynamic trace is a few milliseconds per tracepoint.
  364.   Normally this is small enough not to make a noticeable difference to
  365.   system performance.
  366.  
  367.  
  368.   USER GUIDE
  369.  
  370.   Command Syntax:
  371.  
  372.          DTRACE APPLY trpgm_file [/h=hmte │ /n=name] [/m=major] [/i=id] [/q] [/d]
  373.          DTRACE BUILDTDF trpgm_file [tdf_file] [/m=major] [/n=name] [/i=id] [/q]
  374.   [/d]
  375.          DTRACE REMOVE [trpgm_file │ /h=hmte │ /n=name] [/q] [/d]
  376.          DTRACE CLEARALL [/q] [/d]
  377.          DTRACE QUERY [/h=hmte │ /n=name] [/i=id] [/q] [/d]
  378.          DTRACE GETVARS [/h=hmte │ /n=name] [/i=id] [/v=n:m] [/z] [/r] [/q] [/d]
  379.  
  380.  
  381.   Numeric values may be specified in hexadecimal or decimal. Hexadecimal
  382.   values are signified with either the (C -style) 0x prefix, e.g. 0x2f8;
  383.  
  384.   
  385.                                                              Overview  5
  386.  
  387.                         July 18, 1997 - Warp Debug
  388.  
  389.   or the (assembler-style) h suffix, e.g. 2f8h
  390.  
  391.   Optional command line parameters (/i, /m,  /h and /n) set defaults
  392.   which override the default settings in the header of the trace program
  393.   file.  Overrides for specific tracepoints take precedence over the
  394.   command line and the header in the trace program file.
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.   
  442.                                                              Overview  6
  443.  
  444.                         July 18, 1997 - Warp Debug
  445.  
  446.   hmte: module handle (any module with an MTE). May be specified also in
  447.         the trace program file.
  448.  
  449.   name: module name.
  450.         name may specify a simple name, a name and extension or a
  451.         fully qualified name with path information.
  452.  
  453.         If a fully qualified name is specified then it is used without
  454.         modification to determine the module handle. If this is unccessful
  455.         the no attempt is made to search for the module.
  456.  
  457.         For partially specified names DTRACE attempts to work out the
  458.         module handle according to the following assumptions:
  459.  
  460.            if a simple name without extension is specified then .DLL is
  461.            assumed. If the DLL is not loaded then LIBPATH is used to search
  462.            and load the DLL.
  463.  
  464.            All other module types must specify at the very least
  465.            name and extension. If the module is not already loaded then
  466.            PATH is seached for determine the fully qualified module name
  467.            and hence the module handle.
  468.  
  469.  
  470.         The following types of module may be traced:
  471.  
  472.            Physical Device Drivers
  473.            Virtual Device Drivers
  474.            File System Drivers
  475.            Printer Drivers
  476.            Queue Drivers
  477.            Custom DLLs (DLLs with non-DLL extension names)
  478.            EXE modules
  479.            Custom EXE modules (EXEs with a non_EXE extension or no extension)
  480.            Base device drivers.
  481.            Any of the above in non-PATH or LIBPATH directories.
  482.  
  483.         For BASEDEVs the system records the path name as
  484.         being the root directory of the boot drive regardless of which
  485.         directory the driver was loaded from. DTRACE will attempt to
  486.         derive the module handle of a BASEDEV automatically if only
  487.         name and extension are supplied.
  488.  
  489.         Build BUILDTDF may be used for non-DLL modules however under
  490.         OS/2 3.0+ JR09872 is required for the TRACE command to process
  491.         TDFs for non-DLL modules.
  492.  
  493.   major: The default major code. May also be specified in the trace program
  494.          file. Major codes specified with specific tracepoints in the trace
  495.          program file override any other specification.
  496.  
  497.  
  498.   
  499.                                                              Overview  7
  500.  
  501.                         July 18, 1997 - Warp Debug
  502.  
  503.   id: Superset grouping of tracepoints. May include more than one major
  504.       code. Defaults to 0 when defining tracepoints. NB dynamic trace
  505.       generated by TRCUST uses id=0, unless overridden by TDFID=. Id may
  506.       be specified also in the trace program file.
  507.  
  508.       Id is intended for use with the  QUERY and GETVARS functions.
  509.       These functions will assume all non-zero ids are to be processed if
  510.       id is not specified.
  511.  
  512.   n:m Variables n to m. Dynamic Trace variables are referred to by index number
  513.       starting with 0. Number of variables defined is determined by the
  514.       vars= statement of the trace program file.
  515.  
  516.   z:  Zero variables.
  517.  
  518.   r:  Read variables.
  519.  
  520.   q:  Suppress copyright and incidental informational messages.
  521.  
  522.   d:  Debugging switch. This is provided for diagnosing problems with DTRACE.
  523.       It should only be used at the request of Service personnel.
  524.       Note: DTRACE also has associated DTRACE.TDF and TRC0063.TFF files which
  525.       permit inernal tracing of DTRACE itself by means of TRACE ON DTRACE.EXE
  526.  
  527.   trpgm_file: Trace program file. If a simple name is specified then
  528.       an extension of .RPN is assumed.
  529.       See below. for the file description.
  530.  
  531.   tdf_fiie: The generated Trace Definition File name. See below.
  532.  
  533.  
  534.   Options that may also be specified in the trace program file are
  535.   overridden when specified on the command line.
  536.  
  537.  
  538.   DTRACE FUNCTIONS
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.   
  556.                                                              Overview  8
  557.  
  558.                         July 18, 1997 - Warp Debug
  559.  
  560.   APPLY:    Insert dynamic tracepoints, specified by the trace program
  561.             file for a module specified by name or hmte. A full
  562.             description of the trace program file is given below.
  563.  
  564.   BUILDTDF: Build a Trace Definition File (TDF) from the definitions
  565.             supplied in the trace program file. The OS/2 TRACE command
  566.             may be used subsequently to apply or removed all or selected
  567.             tracepoints defined in the TDF.
  568.  
  569.             TFD files must be stored in the current directory, DPATH or
  570.             in \OS2\SYSTEM\TRACE.
  571.  
  572.             BUILDTDF permits group and type classifications to be
  573.             specified with each tracepoint. These may be used by the
  574.             OS/2 TRACE command to select subsets of tracepoints to be
  575.             activated. The TRACE command also permits specific minor
  576.             codes, or ranges of minor codes to be specified.
  577.  
  578.             The syntax for the TRACE command using a TDF file is as
  579.             follows:
  580.  
  581.                    TRACE ON│OFF tdf_file
  582.  
  583.               or   TRACE ON tdf_file(minor spec)
  584.  
  585.               or   TRACE ON tdf_file(group spec)
  586.  
  587.               or   TRACE ON tdf_file(type spec)
  588.  
  589.             where:
  590.  
  591.                    tdf_file is the file name, excluding path and
  592.                    extension of the tdf_file.
  593.  
  594.                    minor spec is a combination of minor code or
  595.                    ranges of minor codes separated by commas.
  596.                    In the following example KERNEL minor codes
  597.                    (decimal) 1, 2 through 10 and 401 are traced.
  598.  
  599.                       TRACE ON KERNEL(1,2-10,401)
  600.  
  601.                    group spec is a combination of groups separated by
  602.                    commas. Each group may further specify one or more
  603.                    types.
  604.                    In the following example KERNEL group FS (with
  605.                    all types) and TK with types PRE and POST is traced.
  606.  
  607.                       TRACE ON KERNEL(FS,TK:PRE+POST)
  608.  
  609.                    type spec is a combination of types separated by
  610.                    commas. In the following example all KERNEL PRE and
  611.  
  612.   
  613.                                                              Overview  9
  614.  
  615.                         July 18, 1997 - Warp Debug
  616.  
  617.                    POST type tracepoints are traced.
  618.  
  619.                       TRACE ON KERNEL(PRE,POST)
  620.  
  621.             Notes:
  622.  
  623.             Due to a limitation with the TRACE command, BUILDTDF
  624.             can only be used to create TDFs for DLLs and OS2KRNL unless
  625.             JR09872 is installed.
  626.  
  627.             If the TRACE command fails to find the TDF in the DPATH it
  628.             will look in \OS2\SYSTEM\TRACE\SYSTEM.TDF before looking
  629.             finally for \OS2\SYSTEM\TRACE\tdf_file. The becomes an
  630.             important consideration when one of the pre-existing system
  631.             trace definitions is modified or replaced.
  632.  
  633.             The TRACE command fails to find OS2KRNL.TDF in
  634.             in OS2\SYSTEM\TRACE if executed from a command line where
  635.             the current directory is other than on the boot drive.
  636.             APAR PJ23293 addresses this problem.
  637.  
  638.             See the accompanying TRCTOOLS documentation for further
  639.             information of modifying and replacing system trace
  640.             definitions.
  641.  
  642.   REMOVE:   Remove dynamic tracepoints for a module specified by name or
  643.             handle.
  644.  
  645.   CLEARALL: Remove all dynamic tracepoints for all modules.
  646.  
  647.   QUERY:    Query by id or hmte all traced modules, their ids and number
  648.             of Dynamic Trace variables.
  649.  
  650.             By default all non-zero ids are queried.
  651.  
  652.             Note: Standard system dynamic trace definitions and user
  653.             definitions that are defined using TRCUST are always defined
  654.             with id=0.
  655.  
  656.   GETVARS:  Retrieve and/or set to zero the Dynamic Trace variables for
  657.             a given id or module.
  658.  
  659.             By default all variables of all non-zero ids are retrieved.
  660.  
  661.             Variables are displayed as a list in hexadecimal and decimal
  662.             formats.
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.   
  670.                                                             Overview  10
  671.  
  672.                         July 18, 1997 - Warp Debug
  673.  
  674.   FORMAT OF THE TRACE PROGRAM FILE
  675.  
  676.   This file specifies one or more tracepoints for a module.  Each
  677.   tracepoint may have an associated program that species to DynamicTrace
  678.   what variables to manipulate and what data to log in the system trace
  679.   buffer when the tracepoint fires.
  680.  
  681.   Comments may appear after the instructions or on whole lines. They are
  682.   prefixed with a semi-colon.
  683.  
  684.   Blanks are ignored by DTRACE.
  685.  
  686.   The trace program consists of a header followed by one or more
  687.   tracepoint definitions. Each tracepoint definition has a header
  688.   followed by an optional program specified as a sequence of Reverse
  689.   Polish Notation instructions.  The RPN commands use a circular stack
  690.   of 16 double-word elements as a work space.  The top element of the
  691.   stack is the only immediately accessible element.  As each element is
  692.   accessed the top of stack (TOS) pointer is moved to point to the
  693.   preceding stack element - this is referred to as a POP operation even
  694.   though the popped stack element is not actually removed from the
  695.   stack.  Thus an RPN command that takes two stack parameters pops the
  696.   two topmost elements from the stack.  Whenever data on the stack is
  697.   referenced it is done so in integral numbers of elements.  Thus
  698.   pushing or popping a word will move the stack pointer as if a
  699.   double-word had been pushed or popped. Word and byte length data is
  700.   always padded to a double-word when pushed on to the stack.
  701.  
  702.   The trace program may be used for three purposes (which may be
  703.   combined):
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.   
  727.                                                             Overview  11
  728.  
  729.                         July 18, 1997 - Warp Debug
  730.  
  731.   1) To cause one or more items of data to be logged in the system
  732.      trace buffer.
  733.  
  734.   2) To update local variables which are associated with a particular
  735.      module being traced.
  736.   3) To detect a specific condition (value of a register, value in
  737.      memory or code path) and force a System Dump when that condition
  738.      occurs.
  739.  
  740.      NB: this function is not available in all releases of OS/2.
  741.  
  742.  
  743.   The entire set of trace definitions and local variables for a
  744.   particular module is referred to as a Dynamic Trace Object (DTO).
  745.  
  746.  
  747.   One DTO may exist per module. DosDynamicTrace will not merge an
  748.   existing DTO with additional definitions for the same module.
  749.  
  750.  
  751.   DTOs for several modules may be grouped under the same id - see
  752.   the /i parameter above and the id= parameter below.
  753.  
  754.  
  755.   RPN COMMAND SYNTAX
  756.  
  757.   RPN command syntax rules are as follows:
  758.  
  759.   [label:] operator [operand1 [,operand2 [, ..... ]]] [; comment]
  760.   [;comment]
  761.  
  762.   Where:
  763.  
  764.   label
  765.         is an optional string of 1 - 255 characters, excluding ':',
  766.         initiated with a non-numeric character and delimited by a ':'.
  767.         A label must always precede a command, but the command my be
  768.         coded on the following line. Labels are for use by the jump
  769.         instructions as an alternative to coding an explicit numeric
  770.         value. Backward jumping is not permitted.
  771.  
  772.   operator
  773.         is one of the valid RPN commands listed below.
  774.  
  775.   operand1,...
  776.         are operands as defined by each RPN command.
  777.  
  778.  
  779.   A comment is initiated by a ';' and may follow on the same line as a
  780.   command or on a new line.
  781.  
  782.  
  783.   
  784.                                                             Overview  12
  785.  
  786.                         July 18, 1997 - Warp Debug
  787.  
  788.   RPN commands,labels and operators are case insensitive.
  789.  
  790.   Imbedded blanks are ignored.
  791.  
  792.   Data logged by DTRACE may be formatted using TRACEFMT. The format will
  793.   be in hexadecimal bytes unless a custom trace format file has been
  794.   generated using the TRCUST utility. When using TRCUST, specify the TP
  795.   parameter as @STATIC. The prefixes %P and %R may be used. See the OS/2
  796.   Debugging Handbook (SBOF-8617).
  797.  
  798.   Refer to the OS/2 Debugging Handbook, Volume 1 and 3 for further
  799.   information on the system trace utility.
  800.  
  801.  
  802.   FILE HEADER
  803.  
  804.   Zero or more of the following may be specified, in any order:
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.   
  841.                                                             Overview  13
  842.  
  843.                         July 18, 1997 - Warp Debug
  844.  
  845.   vars=     Number of Dynamic Trace variables to be defined
  846.             (initialised to zero).
  847.   major=    Major code
  848.   hmte=     Module handle
  849.   id=       DTO grouping id - not to be confused with typedef or
  850.             groupdef ids. This is a gouping of Dynamic Trace Objects.
  851.             The default DTO id is 0. Id is used with GETVARS and QUERY
  852.             functions.
  853.   logmax=   Maximum data to be logged in the trace buffer (default 512
  854.             bytes).
  855.   name=     Module name. See name specification above.
  856.   typedef=  Defines a type keyword. This is used only by the BUILDTDF
  857.             function. The definition is specified as:
  858.  
  859.                  typedef=keyword,id.
  860.  
  861.              Keyword is a string, which is used by type statements, see
  862.              below.
  863.  
  864.              id is a value equal to a power of two in the range 2**1 to
  865.              2**31.
  866.  
  867.              Multple typedef statements my be specified.
  868.  
  869.   groupdef= Defines a group keyword. This is used only by the BUILDTDF
  870.             function. The definition is specified as:
  871.  
  872.                  groupdef=keyword,id.
  873.  
  874.              Keyword is a string, which is used by group statements, see
  875.              below.
  876.  
  877.              id is a value in the rande 0x to 0xffffffff.
  878.  
  879.              Multple groupdef statements my be specified.
  880.  
  881.  
  882.   Major code and hmte are required but may be specified or overridden by
  883.   the command line parameters.
  884.  
  885.   If name and hmte are specified then the first parameter encountered
  886.   takes precedence.
  887.  
  888.   id defaults to zero.
  889.  
  890.   vars defaults to zero.
  891.  
  892.   logmax defaults to 512.
  893.  
  894.   The BUILDTDF function requires all definitions to be completely
  895.   specified within the trace program file. Furthermore name must be
  896.  
  897.   
  898.                                                             Overview  14
  899.  
  900.                         July 18, 1997 - Warp Debug
  901.  
  902.   specified rather than a module's hmte.
  903.  
  904.  
  905.   TRACEPOINT HEADER
  906.  
  907.   The following must be specified, in any order, with the exception that
  908.   minor= must appear first.
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.   
  955.                                                             Overview  15
  956.  
  957.                         July 18, 1997 - Warp Debug
  958.  
  959.   minor=    Tracepoint minor code
  960.  
  961.   major=    Tracepoint major code - this may be respecified for
  962.             each tracepoint and overrides the major code specified
  963.             in the file header. This applies to which the current
  964.             tracepoint.
  965.  
  966.   opcode=   Byte of opcode in module where the tracepoint will be
  967.             inserted.
  968.  
  969.   object=   Relative object of module where trace point will be
  970.             applied. Objects are numbered from 1.
  971.  
  972.   offset=   Offset within object where tracepoint will be applied.
  973.  
  974.   major=    The major code override for a specific tracepoint. The
  975.             default major code must be specified in the header to the
  976.             trace program file.
  977.  
  978.   type=     Type is an optional parameter that is used only by the
  979.             BUILDTDF function. Its purpose is to associate with each
  980.             tracepoint one or more types. These are used by the
  981.             OS/2 TRACE command as a means of selecting a subset of the
  982.             tracepoints defined in the generated TDF. The operand to the
  983.             type= statement is be specified as a sequence of one or more
  984.             keyword names defined by typedef statements, separated
  985.             '+' signs as follows:
  986.  
  987.                 type=[keyword1[+keyword2 ...]]
  988.  
  989.             A typical use of the trace type is to associate a particular
  990.             tracepoint with a particular characteristic. For example,
  991.             tracepoints in DOSCALL1 and KERNEL use type=PRE for API
  992.             pre-invocation tracepoints and type=POST for
  993.             API post-invocation tracepoints.
  994.  
  995.             Only one type statement is permissible per tracepoint.
  996.  
  997.   group=    Group is an optional parameter that is used only by the
  998.             BUILDTDF function. Its purpose is to associate related
  999.             subsets of the set of tracepoints defined in the generated
  1000.             TDF. These are used by the OS/2 TRACE command as a means of
  1001.             selecting a subset of the tracepoints defined in the
  1002.             generated TDF. The operand to the group= statement is
  1003.             specified as a single keyword name that has been defined by
  1004.             the groupdef statements.
  1005.  
  1006.             A typical use of the trace group is to associate all
  1007.             tracepoints that relate to a particular component of the
  1008.             system. For example, the group FS is used to associate all
  1009.             tracepionts in DOSCALL1 and KERNEL that relate to the
  1010.  
  1011.   
  1012.                                                             Overview  16
  1013.  
  1014.                         July 18, 1997 - Warp Debug
  1015.  
  1016.             file-system.
  1017.  
  1018.             Group is intended to be an exclusive classification of
  1019.             tracepoints compared with Type. Only one group may be
  1020.             associated with a particular tracepoint, whereas a
  1021.             tracepoint may have several type.
  1022.  
  1023.             Only one group statement is permissible per tracepoint.
  1024.  
  1025.  
  1026.  
  1027.  
  1028.   THE TRACE PROGRAM
  1029.  
  1030.   Trace program may specify any meaningful combination of the following
  1031.   RPN instructions. (TOS = Top of Stack).
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.   
  1069.                                                             Overview  17
  1070.  
  1071.                         July 18, 1997 - Warp Debug
  1072.  
  1073.   Leng  Mnem  Operand(s)  Description
  1074.   -th   -onic
  1075.   Bytes
  1076.   ---------------------------------------------------------------------
  1077.   1     Abort             Abort - Log No Information
  1078.   1     Add               Add top 2 DWORD stack elements
  1079.   1     Cnvrt DXS         Convert Dword to Segmented
  1080.   1     Cnvrt FXS         Convert Flat to Segmented
  1081.   1     Cnvrt SXD         Convert Segmented to Dword
  1082.   1     Cnvrt SXF         Convert Segmented to Flat
  1083.   3     Inc   V,word      Increment Immediate Variable
  1084.   1     Inc   VIi         Increment indexed Variable
  1085.   3     Jmp   N,word      Jump forward N bytes or to a label
  1086.   3     Jmp   NN,word     Jump forward N bytes or to a label if TOS < 0
  1087.   3     Jmp   PN,word     Jump forward N bytes or to a label if TOS > 0
  1088.   3     Jmp   ZN,word     Jump forward N bytes or to a label if TOS = 0
  1089.   1     Log   ARF         Log ASCIIZ at Flat Range
  1090.   1     Log   ARS         Log ASCIIZ at Segmented Range
  1091.   2     Log   DN,byte     Log N DWORDs
  1092.   1     Log   MRF         Log Memory at Flat Range
  1093.   1     Log   MRS         Log Memory at Segmented Range
  1094.   2     Log   WN,byte     Log N WORDs
  1095.   3     Move  V,word      Move top of stack to Immediate Var.
  1096.   1     Move  VIi         Move top of stack to indexed Var.
  1097.   1     Mul               Multiply top 2 stack elements
  1098.   3     Or    V,word      OR immed. indexed variable with TOS
  1099.   2     Pop   N,byte      Rotate stack down (pop) N times
  1100.   1     Push  CS          Push contents of (CS)
  1101.   5     Push  D,dword     Push DWORD Immediate
  1102.   1     Push  DS          Push contents of (DS)
  1103.   1     Push  EAX         Push contents of (EAX)
  1104.   1     Push  EBP         Push contents of (EBP)
  1105.   1     Push  EBX         Push contents of (EBX)
  1106.   1     Push  ECX         Push contents of (ECX)
  1107.   1     Push  EDI         Push contents of (EDI)
  1108.   1     Push  EDX         Push contents of (EDX)
  1109.   1     Push  EFlags      Push contents of (EFlags)
  1110.   1     Push  EIP         Push contents of (EIP)
  1111.   1     Push  ES          Push contents of (ES)
  1112.   1     Push  ESI         Push contents of (ESI)
  1113.   1     Push  ESP         Push contents of (ESP)
  1114.   1     Push  FIF         Push Flat Indirect Flat
  1115.   1     Push  FS          Push contents of (FS)
  1116.   1     Push  GS          Push contents of (GS)
  1117.   5     Push  OXF,dword   Push (DWORD Object to Flat Address)
  1118.   2     Push  OXS,byte    Push (Object to Selector)
  1119.   1     Push  SIS         Push Segmented Indirect Segmented
  1120.   1     Push  SS          Push contents of (SS)
  1121.   3     Push  V,word      Push Immediate Variable
  1122.   1     Push  VIi         Push indexed Variable
  1123.   3     Push  W,word      Push WORD Immediate
  1124.  
  1125.   
  1126.                                                             Overview  18
  1127.  
  1128.                         July 18, 1997 - Warp Debug
  1129.  
  1130.   1     Push  WIS         Push WORD Indirect Segmented
  1131.   1     Remove            Remove the current tracepoint
  1132.   1     Sub               Subtract top 2 stack elements
  1133.   1     SysDump           Force a system Dump (*)
  1134.   1     And               AND top 2 stack elements (*)
  1135.   1     Or                OR top 2 stack elements (*)
  1136.   1     Xor               XOR top 2 stack elements (*)
  1137.   1     Neg               1's complement TOS (*)
  1138.   1     Exit              Log data and exit tracepoint (*)
  1139.   3     SetMin W,word     Override the tracepoint minor code with 'word' (**)
  1140.   1     SetMin            Override the tracepoint minor code from TOS    (**)
  1141.   3     SetMaj W,word     Override the tracepoint major code with 'word' (**)
  1142.   1     SetMaj            Override the tracepoint major code from TOS    (**)
  1143.   1     Xchg              Swap top two elements on the stack.            (**)
  1144.  
  1145.  
  1146.   * Each of the commands flagged with (*) require APAR PJ22196 applying
  1147.   to the OS2KRNL (available with Warp 3.0 FixPak 29 and Warp 4.0 GA).
  1148.  
  1149.   ** Each of the commands flagged with (**) will be supported the GA
  1150.   version of OS/2 Warp 4.0 and Warp 3.0 FixPak 29.
  1151.  
  1152.   Each of these commands acts as follows:
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.   
  1183.                                                             Overview  19
  1184.  
  1185.                         July 18, 1997 - Warp Debug
  1186.  
  1187.   PUSH: Push a value on to the RPN stack
  1188.  
  1189.      In Push SS and Push ESP the value of SS and ESP is dependent on whether the
  1190.      tracepoint occurred at ring 0 or not.
  1191.  
  1192.      In Push EIP, the EIP on the stack is one too large, due to the
  1193.      INT3.
  1194.  
  1195.      Push W takes a word operand, zero extends it, and pushes
  1196.      it on to the RPN stack.
  1197.  
  1198.      Push OXS converts its byte operand into a selector,
  1199.      zero extends that value, and pushes it on to the stack.
  1200.      The byte operand is on object number of the module which
  1201.      is currenlty being traced.
  1202.      Because MTEs may eventually become nonresident, the selectors
  1203.      (up to 256) are stored in an array by DynamicTrace  when the tracepoints
  1204.      were inserted.  The word operand indexes this array to get the sel.
  1205.  
  1206.      Push WIS pops an offset, then a selector, from the RPN stack,
  1207.      fetches the user word at that 16:16 address, zero extends it,
  1208.      and pushes that on to the RPN stack.
  1209.      If the address is invalid or not present, a GP fault or Page
  1210.      fault record will be logged in the buffer, and the interpreter
  1211.      will exit.
  1212.  
  1213.      Push SIS pops an offset, then a selector, from the RPN stack,
  1214.      fetches the user dword at that 16:16 address and pushes that on to
  1215.      the RPN stack in the segmented address format.* That is,
  1216.      the high word (selector) is zero extended and pushed, and then
  1217.      the low word (offset) is zero extended and pushed.
  1218.      If the address is invalid or not present, a GP fault or Page
  1219.      fault record will be logged in the buffer, and the interpreter
  1220.      will exit.
  1221.  
  1222.      Push OXF converts its dword operand into a flat address,
  1223.      and pushes that on to the stack. See description of PUSH OXS for
  1224.      more details.
  1225.  
  1226.      Push FIF pops a Dword from the RPN stack, and then
  1227.      pushes the dword at that flat address on to the stack.
  1228.  
  1229.      Push V takes a word operand. Push V uses that to index
  1230.      to the Dynamic Trace variable in the current DTO, and pushes the value
  1231.      it finds there.
  1232.  
  1233.      Push VIi fetches an index of a Dynamic Trace variable from
  1234.      the top of the stack, (without doing a pop), and then
  1235.      pushes the value of that variable on to the stack.
  1236.  
  1237.   LOG: Log data in the system trace buffer.
  1238.  
  1239.   
  1240.                                                             Overview  20
  1241.  
  1242.                         July 18, 1997 - Warp Debug
  1243.  
  1244.  
  1245.      Log WN takes a byte operand, and repeats the following operation
  1246.      that many times:
  1247.         Pop the value from the top of the RPN stack
  1248.         Log the low word of that value, ignoring the high word.
  1249.      If the log overflows, the interpreter will exit without continuing,
  1250.      but will record as much as it can.
  1251.  
  1252.      Log MRS pops the following from the RPN stack:
  1253.        Offset
  1254.        Selector
  1255.        Length
  1256.  
  1257.      Log MRS then zero extends all these values, and attempts to
  1258.      move Length number of bytes from the given 16:16 address into
  1259.      the log buffer.
  1260.  
  1261.      The logged memory is prefixed by 3 bytes :
  1262.        Token byte of 0,
  1263.        Length word (length of logged information, in bytes)
  1264.  
  1265.      If an address is invalid or not present, a GP fault or Page
  1266.      fault record will be logged in the buffer, and the interpreter
  1267.      will exit.
  1268.  
  1269.      If the log overflows, the interpreter will exit without continuing,
  1270.      and without logging the memory.
  1271.  
  1272.      Log ARS pops the following from the RPN stack:
  1273.        Offset
  1274.        Selector
  1275.        Length
  1276.  
  1277.      Log ARS then zero extends all these values, and attempts to
  1278.      move Length number of bytes from the given 16:16 address into
  1279.      the log buffer.  The data transfer will be discontinued if a
  1280.      null byte is fetched.  The null byte will not be logged.
  1281.  
  1282.      The logged string is prefixed by 3 bytes :
  1283.        Token byte of 1,
  1284.        Length word (length of logged information, in bytes)
  1285.  
  1286.      If an address is invalid or not present, a GP fault or Page
  1287.      fault record will be logged in the buffer, and the interpreter
  1288.      will exit.
  1289.  
  1290.      If the log overflows, the interpreter will exit without continuing,
  1291.      and without logging the string.
  1292.  
  1293.      Log DN takes a byte operand, and repeats the following operation
  1294.      that many times:
  1295.  
  1296.   
  1297.                                                             Overview  21
  1298.  
  1299.                         July 18, 1997 - Warp Debug
  1300.  
  1301.         Pop the value from the top of the RPN stack
  1302.         Log the value (as a DWORD)
  1303.  
  1304.      If the log overflows, the interpreter will exit without continuing,
  1305.      but will record as much as it can.
  1306.  
  1307.      Log MRF pops the following from the RPN stack:
  1308.         Flat Address
  1309.         Length
  1310.  
  1311.      Log MRF then zero extends the length, and attempts to move
  1312.      Length number of bytes from the given flat address into
  1313.      the log buffer.
  1314.  
  1315.      The logged memory is prefixed by 3 bytes :
  1316.         Token byte of 0,
  1317.         Length word (length of logged information, in bytes)
  1318.  
  1319.      If an address is not present, a Page fault record will be
  1320.      logged in the buffer, and the interpreter will exit.
  1321.  
  1322.      If the log overflows, the interpreter will exit without continuing,
  1323.      and without logging the memory.
  1324.  
  1325.  
  1326.      Log ARF pops the following from the RPN stack:
  1327.         Flat Address
  1328.         Length
  1329.  
  1330.      Log ARF then zero extends the length, and attempts to move
  1331.      Length number of bytes from the given flat address into
  1332.      the log buffer.  The data transfer will be discontinued if a
  1333.      null byte is fetched.  The null byte will not be logged.
  1334.  
  1335.      The logged string is prefixed by 3 bytes :
  1336.         Token byte of 1,
  1337.         Length word (length of logged information, in bytes)
  1338.  
  1339.      If an address is not present, a Page fault record will be
  1340.      logged in the buffer, and the interpreter will exit.
  1341.  
  1342.      If the log overflows, the interpreter will exit without continuing,
  1343.      and without logging the string.
  1344.  
  1345.  
  1346.      When memory references are invalid the token byte is set to one of
  1347.      the following to indicate the type of error encountered:
  1348.  
  1349.         -1  Invalid Selector
  1350.         -2  Selector not Present
  1351.         -3  Page not Present
  1352.  
  1353.   
  1354.                                                             Overview  22
  1355.  
  1356.                         July 18, 1997 - Warp Debug
  1357.  
  1358.  
  1359.      The byte count is set to 4 and the data logged is the fault
  1360.      address.
  1361.  
  1362.  
  1363.   ADD/SUB/MUL/AND/OR/XOR: Add/Subtact/Multiply the top two stack
  1364.      elements
  1365.  
  1366.      Add pops two DWORDs from the RPN stack, and pushes their sum.
  1367.  
  1368.      Sub pops two DWORDs from the RPN stack, and pushes their
  1369.      difference.   The first value popped is subtracted from the second.
  1370.  
  1371.      Mul pops two DWORDs from the RPN stack, and pushes their
  1372.      product.
  1373.  
  1374.      And pops two DWORDs from the RPN stack, and pushes their
  1375.      bit-wise AND.
  1376.  
  1377.      Or pops two DWORDs from the RPN stack, and pushes their
  1378.      bit-wise Or.
  1379.  
  1380.      Xor pops two DWORDs from the RPN stack, and pushes their
  1381.      bit-wise Xor.
  1382.  
  1383.   NEG: 1's complement top of stack.
  1384.  
  1385.      Neg 1's complements the TOS. No data is pushed or popped.
  1386.  
  1387.   CNVRT: Convert an address
  1388.  
  1389.      Cnvrt FXS pops a dword from the RPN stack, uses CRMA
  1390.      to translate that flat pointer to a 16:16 segmented pointer.
  1391.      It then pushes the selector (zero extended) and then the
  1392.      offset (zero extended) on to the stack.
  1393.  
  1394.      If the flat address does not lie within the compatibility
  1395.      region, the interpreter will exit immediately.
  1396.  
  1397.  
  1398.      Cnvrt SXF pops a selector, then an offset from the RPN stack,
  1399.      uses CRMA to translate that 16:16 pointer to a flat address,
  1400.      and pushes that flat address on to the stack.
  1401.  
  1402.      If the segmented address does not lie within the comparability
  1403.      region (GDT selector), the interpreter will exit immediately.
  1404.  
  1405.      Cnvrt DXS pops a DWORD, then pushes the high word (zero
  1406.      extended) and then the low word (zero extended).  No CRMA is
  1407.      applied.
  1408.  
  1409.  
  1410.   
  1411.                                                             Overview  23
  1412.  
  1413.                         July 18, 1997 - Warp Debug
  1414.  
  1415.      Cnvrt SXD pops a low word, then a high word, then
  1416.      concatenates them into a DWORD, and pushes the result.
  1417.  
  1418.  
  1419.   POP: Pop a value from the RPN stack.
  1420.  
  1421.        Pop N takes a byte operand, and pops that many operands
  1422.        from the stack.  As the values are not actually removed from
  1423.        the 16-element circular stack, Pop N effectively rotates
  1424.        the stack down.
  1425.  
  1426.  
  1427.   MOVE: Move a value to a variable.
  1428.  
  1429.      Move V takes a word operand. Move V then moves
  1430.      the value on the top of the stack to the Dynamic Trace variable
  1431.      in the current DTO at that index.  The top of stack pointer
  1432.      is not changed.
  1433.  
  1434.      Move VIi pops a variable index off the top of the stack,
  1435.      and then pops a value off the top of the stack.  The value is moved
  1436.      into the Dynamic Trace variable in the current DTO at that index.
  1437.      The variable and the index are then pushed back on to the stack,
  1438.      so that there is no net change on the stack at all.
  1439.  
  1440.      If the index is too large, the interpreter will exit with an error.
  1441.  
  1442.   INC: Increment a variable.
  1443.  
  1444.      Inc V takes a word operand, and increments the value in the
  1445.      Dynamic Trace variable in the current DTO at that index.
  1446.  
  1447.      Inc VIi fetches an index of a Dynamic Trace variable from
  1448.      the top of the stack, (without doing a pop), and then
  1449.      increments the value of that variable.
  1450.  
  1451.      If the index is too large, the interpreter will exit with an error.
  1452.  
  1453.  
  1454.   JMP: Jump forward in the RPN program.
  1455.  
  1456.      Jmp takes a word or label as operand.  Jmp causes an
  1457.      unconditional jump forward in the instruction stream by
  1458.      that number of bytes, relative to the first byte of the next
  1459.      instruction.
  1460.  
  1461.      Therefore, Jmp by 0 bytes is a NOP (i.e jmp n,0)
  1462.  
  1463.  
  1464.      Jmp ZN takes a word or label as operand.  Jmp ZN causes an
  1465.      unconditional jump forward in the instruction stream by
  1466.  
  1467.   
  1468.                                                             Overview  24
  1469.  
  1470.                         July 18, 1997 - Warp Debug
  1471.  
  1472.      that number of bytes, relative to the end of the instruction,
  1473.      but only if the value on the top of the stack is zero.
  1474.  
  1475.      Jmp NN takes a word or label operand.  JmpNN causes an
  1476.      unconditional jump forward in the instruction stream by
  1477.      that number of bytes, relative to the end of the instruction,
  1478.      but only if the value on the top of the stack is negative.
  1479.  
  1480.      Jmp PN takes a word or label operand.  Jmp PN causes an
  1481.      unconditional jump forward in the instruction stream by
  1482.      that number of bytes, relative to the end of the instruction,
  1483.      but only if the value on the top of the stack is positive.
  1484.  
  1485.      To prevent loops, no backward jumps are permitted.  Also, it is
  1486.      illegal to jump into the code stream for another tracepoint.
  1487.  
  1488.      If labels are specified, DTRACE calculates the relative forward
  1489.      offset.
  1490.  
  1491.   REMOVE: Remove and Abort the current tracepoint.
  1492.  
  1493.   ABORT:  Abort the tracepoint.
  1494.  
  1495.      Abort aborts the tracepoint entirely.  The interpreter
  1496.      exits, but does not log any information.  The data logged
  1497.      by this tracepoint is lost.
  1498.  
  1499.      However, alterations to the variables remain.
  1500.  
  1501.      By using Abort in combination with the Jmp
  1502.      instructions, unnecessary tracepoints can be filtered
  1503.      at run time, without crowding or overflowing the log buffer.
  1504.  
  1505.   EXIT:  Exit the tracepoint.
  1506.  
  1507.      Exit terminates the tracepoint.  The interpreter
  1508.      exits, and logs any information requested so far. The tracepoint
  1509.      remains in tact.
  1510.  
  1511.      By using Exit in combination with the Jmp
  1512.      instructions, specific conditions can be detected before logging
  1513.      additional data.
  1514.  
  1515.      If Exit is not available (systems without PJ22196) then the
  1516.      equivalent may be achieved by coding:
  1517.  
  1518.            jmp n,exit
  1519.            .
  1520.            .
  1521.            .
  1522.            .
  1523.  
  1524.   
  1525.                                                             Overview  25
  1526.  
  1527.                         July 18, 1997 - Warp Debug
  1528.  
  1529.      exit: jmp n,0 ;nop
  1530.  
  1531.  
  1532.   ORV: OR a Dynamic Trace variable with TOS.
  1533.  
  1534.   SYSDUMP: Force a System Dump.
  1535.  
  1536.      SysDump transfers control to the stand alone dump process. No
  1537.      data is logged. No system shutdown is performed and normal
  1538.      system execution is terminated immediately.
  1539.  
  1540.      Use this command with the Jmp instructions to detect illusive error
  1541.      conditions that require dump analysis at the point of error.
  1542.  
  1543.  
  1544.   SETMAJ: Override the tracepoint major code
  1545.  
  1546.      SetMaj takes the word value from the TSO to override the tracepoint
  1547.      major code. The override remains in effect until the current RPN
  1548.      program exits. Since data is not logged to the system trace buffer
  1549.      until the RPN program exits, the major code may be overridden at any
  1550.      point and remain effective for the whole trace entry.
  1551.  
  1552.      SetMaj may be specified with the W,word operand form. In this case
  1553.      'word' forms the major code override.
  1554.      Note: The system trace facility currently admits only major codes
  1555.      from 0 - 255. Any specification of a major code greater than 255
  1556.      will be treated as if the high-order byte value is zero.
  1557.  
  1558.      This is provided to allow trace formatting templates to be
  1559.      selected dynamically according to the data logged.
  1560.  
  1561.   SETMIN: Override the tracepoint minor code
  1562.  
  1563.      SetMin takes the word value from the TSO to override the tracepoint
  1564.      minor code. The override remains in effect until the current RPN
  1565.      program exits. Since data is not logged to the system trace buffer
  1566.      until the RPN program exits, the minor code may be overridden at
  1567.      any point and remain effective for the whole trace entry.
  1568.  
  1569.      SetMin may be specified with the W,word operand form. In this case
  1570.      'word' forms the minor code override.
  1571.  
  1572.      The system trace facility admit minor codes in the range from
  1573.      0x0000 to 0xffff.
  1574.  
  1575.      This is provided to allow trace formatting templates to be
  1576.      selected dynamically according to the data logged.
  1577.  
  1578.  
  1579.   XCHG: Exchange the top two entries on the RPN Stack.
  1580.  
  1581.   
  1582.                                                             Overview  26
  1583.  
  1584.                         July 18, 1997 - Warp Debug
  1585.  
  1586.  
  1587.      Xchg pops the top two stack elements then pushes them back on to
  1588.      the stack in the reverse order.
  1589.  
  1590.  
  1591.  
  1592.  
  1593.   TRACE PROGRAM EXAMPLES
  1594.  
  1595.   The following examples illustrate common usages of the RPN commands.
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.   
  1639.                                                             Overview  27
  1640.  
  1641.                         July 18, 1997 - Warp Debug
  1642.  
  1643.   1) Log AX and BX registers:
  1644.  
  1645.          Push EBX
  1646.          Push EAX
  1647.          Log  WN,2 ;lower 16 bits of each DWORD
  1648.  
  1649.   2) Log EIP, EBP and EAX:
  1650.  
  1651.          Push EAX
  1652.          Push EBP
  1653.          Push EIP
  1654.          Log  DN,3  ;3 DWORDs from the stack
  1655.  
  1656.   3) Log value at EBP+ESI:
  1657.  
  1658.          Push W,4  ; push immediate value 4 - length to log
  1659.          Push EBP
  1660.          Push ESI
  1661.          Add       ; add top two DWORDs - puts EBP+ESI on stack
  1662.          Log  MRF  ; log memory at flat address range
  1663.  
  1664.   4) Log value at SS:SP using 16-bit segmented addressing:
  1665.  
  1666.          Push W,9  ; push immediate  value 9 - length to log
  1667.          Push SS
  1668.          Push ESP
  1669.          Log  MRS  ; log memory at segmented address range
  1670.  
  1671.   5) Log 16 bytes of data pointed to by the flat address at SS:SP+8
  1672.  
  1673.          Push W,16 ; push immediate value 16 - length to log
  1674.          Push SS
  1675.          Push ESP
  1676.          Push 8    ; offset 8
  1677.          Add       ; 8 added to ESP value on stack
  1678.          Push SIS  ; pop ESP then SS and pop Dword at that address
  1679.                    ; as two Words extended to Dwords (as if it was a sel:offset).
  1680.                    ; stack now contains the length and split address of data to log
  1681.          Cnvrt SXD ; Concatenate the two words to form a flat address
  1682.          Log  MRF  ; log the data.
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.   
  1696.                                                             Overview  28