home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mod201j.zip / modula2.exe / os2src / dumper.def < prev    next >
Text File  |  1996-01-25  |  4KB  |  118 lines

  1. DEFINITION MODULE DUMPER;
  2.  
  3. (*************************************************************************
  4.    DUMPER.DEF      Interface for postmortem debugger SeeDump's DUMPER.DLL
  5.  
  6.    This file requires the postmortem debugger "SeeDump".
  7.    "SeeDump" is distributed by
  8.  
  9.       a priori computer solutions GmbH, Munich, Germany
  10.         E-Mail: 100137.2315@compuserve.com
  11.         Fax:    +49-69-236426
  12.  
  13.    DUMPER.DLL sets up a new OS/2 exception handler
  14.    which will then generate a special dump file
  15.    for the postmortem debugger.
  16.  
  17.    The program importing this definition should intialize the 
  18.    DUMPER.DLL as follows:
  19.  
  20.    MODULE ...
  21.      (*$XL+*)
  22.      (*$CDECL+*)
  23.      ...
  24.    IMPORT DUMPER;
  25.      ....
  26.    VAR
  27.      ExceptReg  : DUMPER.SEEDUMPREGREC;
  28.      ...
  29.    BEGIN (* of program module *)
  30.      ExceptReg.prev_structure   := NIL;
  31.      ExceptReg.ExceptionHandler := NIL;
  32.      ExceptReg.flag             := DUMPER_DEFAULT;
  33.      ExceptReg.DoTheDumpEnv     := NIL;
  34.      ExceptReg.EndThreadHandler := 0;
  35.      _SETXCPTHANDLER( DUMPER_VERSION, ExceptReg );
  36.      ...
  37.    END. (* of program module *)
  38.  
  39.   Copyright (c) 1996 by Juergen Neuhoff
  40. *************************************************************************)
  41.  
  42. (*$XL+     extended M2-language *)
  43. (*$CDECL+  C-style procedures   *)
  44.  
  45. FROM OS2DEF IMPORT PVOID, ULONG, PCHAR;
  46.  
  47. (********************************************************************
  48.  _SETXCPTHANDLER will register an exception handler to write a dump
  49.  whenever the thread, which has issued this call, traps.
  50.  
  51.  parameter "flag" can take the value EXIT_THREAD to indicate that only the
  52.            thread where the exception occurred should be terminated.
  53.            If this bit is not set, the process will be terminated.
  54.            A new file can be written each time by specifying
  55.            DUMPER_NEWFILE. In this case up to 10 dump files will be
  56.            written to the dump directory.
  57.            The directory for the dumps can be set using the environment
  58.            variable SEEDUMPDUMPDIR. If not set, the current directory is
  59.            used.
  60.            If a trap occurs, some information is displayed using
  61.            printf. This is set using the DUMPER_VERBOSE parameter.
  62.            The DUMPER_EXITLIST displays some information as the process
  63.            terminates.
  64.  
  65.  parameter "DoTheDumpEnv" points to a string which can be used to specify
  66.            an environment variable. When a trap occurs, this variable is
  67.            checked.  If it is not set, the exception is passed to OS/2.  If
  68.            it is set, the dump file is written.  For example, use
  69.            DoTheDumpEnv = "WRITE_DUMP" to write a dump file only if the
  70.            environment variable "WRITE_DUMP" is set.  The empty string ""
  71.            is interpreted to always take a dump.
  72.  
  73.  parameter "EndThreadHandler" can be used with the DUMPER_EXITTHREAD
  74.            parameter. This should contain the address of the function
  75.            to call to terminate the thread. Default is DosExit( EXIT_THREAD ).
  76.  
  77.  parameter "regrec" must point to the struct SEEDUMPREGREC
  78.            which must be addressable when an exception occurs.
  79.            The best place to declare it, is at the very beginning of main
  80.            or the entry routine of a thread.
  81. ********************************************************************)
  82.  
  83. CONST
  84.   DUMPER_VERSION     = 00010001H;
  85.   DUMPER_EXITTHREAD  = 00000001H;
  86.   DUMPER_EXITLIST    = 00000002H;
  87.   DUMPER_VERBOSE     = 00000004H;
  88.   DUMPER_NEWFILE     = 00000008H;
  89.  
  90.   DUMPER_DEFAULT     = ( DUMPER_EXITTHREAD OR 
  91.                          DUMPER_EXITLIST   OR
  92.                          DUMPER_VERBOSE    OR 
  93.                          DUMPER_NEWFILE
  94.                        );
  95.  
  96. (*$V+*)
  97.  
  98. TYPE
  99.   SEEDUMPREGREC      = RECORD
  100.     prev_structure     : PVOID;  (* volatile *)
  101.     ExceptionHandler   : PVOID;  (* volatile *)
  102.     flag               : ULONG;         
  103.     DoTheDumpEnv       : PCHAR;         
  104.     EndThreadHandler   : ULONG;         
  105.                        END;
  106.   PSEEDUMPREGREC     = POINTER TO SEEDUMPREGREC;
  107.  
  108. (*$V-*)
  109.  
  110. PROCEDURE _SETXCPTHANDLER
  111. (
  112.   version    : ULONG;
  113.   VAR regrec : SEEDUMPREGREC
  114. );
  115.  
  116.  
  117. END DUMPER.
  118.