Super Prev

The HIS utility

XDS runtime support contains routines that in case of abnormal program termination may trace back the stack of the thread that is in error and output the call chain into a file called errinfo.$$$. To enable this, the option GENHISTORY has to be turned ON during compilation of the main module of the program.

The HIS utility takes the stack trace file as input and prints execution history of the crashed thread in terms of line numbers and procedure names (provided that the respective executable components contain debug information):

    XDS History formatter, Version 1.0
    (c) 1996-97 XDS Ltd.
    #RTS: unhandled exception #6: zero or negative divisor
    Source file                     LINE  OFFSET  PROCEDURE        COMPONENT
    hisdemo.mod                        5  00000F  Div              hisdemo.exe
    hisdemo.mod                       11  000037  Try              hisdemo.exe
    hisdemo.mod                       15  000061  main             hisdemo.exe

In the above example, division by zero has been detected at line 5 in the procedure Div that was called by the procedure Try at line 11, and the procedure Try, in turn, was called from the main module body at line 15. All these procedures are defined in file hisdemo.mod and their code reside in the executable file hisdemo.exe.

By default, HIS prints to the standard output. Use -l=file option to redirect it to file.

The -f option tells HIS to output full names of source files.

HIS is also able to facilitate quick reproduction of the erroneous situation in XD. Launching HIS with the -b=file option creates a debugger control file that would stop the program immediately before execution of the instruction that causes crash:

    ; XDS History formatter, Version 1.0
    ; (c) 1996-97 XDS Ltd.
    ; XDS Debugger control file
    ; 1. Load the program
      LOAD F:\xds\samples\modula\hisdemo.exe  
    ; 2. Establish breakpoint-counter
      MODULE hisdemo$
      BREAK Counter, LINE, hisdemo, 5, .
    ; 3. Initiate program execution at the first time
    ; 4. When program has finished, establish delayed sticky breakpoint
      MODULE hisdemo$
      BREAK Break, LINE, hisdemo, 5, Switch_To_Dialog, @PASS(Counter)-1
    ; 5. Delete auxiliary breakpoint
      DEL Counter
    ; 6. Initiate program execution for the second time
    ; 7. Upon the breakpoint hit, switch to the dialog mode
      DIALOG #RTS: unhandled exception #6: zero or negative divisor

You may use the -c option if you do not want comments to appear in the control file.

The -d option forces HIS to immediately launch the debugger with the created control file. If the -b option was not specified, a temporary control file is created.

The -s option disables trace of the control file execution in the debugger.