home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / os2trace.zip / TRACE-IT.CMD < prev   
OS/2 REXX Batch file  |  2001-01-10  |  3KB  |  95 lines

  1. @rem @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2. @rem
  3. @rem File name    : TRACE-IT.CMD
  4. @rem
  5. @rem Title        : OS/2 API Trace Batch File
  6. @rem
  7. @rem Description  : Performs all the commands necessary to trace a .EXE file.
  8. @rem                The most possible trace information is logged.  Up to eight
  9. @rem                command line arguments can be passed to the .EXE.
  10. @rem
  11. @rem Usage        : TRACE-IT progname [progparm]...
  12. @rem
  13. @rem                Where:
  14. @rem                  progname is exectuable name without .EXE extension
  15. @rem                  progparm is optional program parameter (8 maximum)
  16. @rem
  17. @rem                In the following example,  EDIT.EXE is traced while editing
  18. @rem                CONFIG.SYS in the root directory of the C: drive:
  19. @rem
  20. @rem                TRACE-IT edit c:\config.sys
  21. @rem
  22. @rem History      : Version Date    Item
  23. @rem                2.40.38 15Aug97 Added TRACE-IT batch file
  24. @rem                2.40.81 02Dec98 Added -E option
  25. @rem                2.45.16 18Feb00 Added -C, -PAUSE, and -RESUME options
  26. @rem                2.45.24 01Jun00 Added -A option
  27. @rem
  28. @rem @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  29. @
  30. @rem Issue an error if at least one argument, the executable file name without
  31. @rem an extension, is not passed in on the command line
  32. @
  33. @if .%1 == . goto error1
  34. @
  35. @rem Issue an error if the executable file does not exist
  36. @
  37. @if not exist %1.exe goto error2
  38. @
  39. @rem Customize tracing to log the most information possible
  40. @
  41. @os2trace -a none -b all -c off -d all -e on -f all -g all -i on -l 3 -t on -w all
  42. @
  43. @rem Enable the executable file to trace APIs from all of the supported DLLs
  44. @
  45. @os2trace -on -all %1.exe
  46. @
  47. @rem Run the executable file, passing in up to eight command line arguments
  48. @
  49. @%1 %2 %3 %4 %5 %6 %7 %8 %9
  50. @
  51. @rem Disable the executable file from tracing
  52. @
  53. @os2trace -off -all %1.exe
  54. @
  55. @rem Issue an error if the trace information file does not have the same file
  56. @rem name as the executable, indicating that the executable imports from none
  57. @rem of the supported DLLs or another instance of the executable was running
  58. @
  59. @if not exist %1.trc goto error3
  60. @echo.
  61. @echo Trace results are in %1.TRC
  62. @goto quit
  63. @
  64. @rem Issue usage message and terminate
  65. @
  66. :error1
  67. @echo.
  68. @echo Usage: TRACE-IT progname [progparm]...
  69. @echo Where: progname is exectuable name without .EXE extension
  70. @echo        progparm is optional program parameter (8 maximum)
  71. @goto quit
  72. @
  73. @rem Issue executable file not found message and terminate
  74. @
  75. :error2
  76. @echo.
  77. @echo TRACE-IT Error: %1.EXE does not exist in current directory
  78. @goto quit
  79. @
  80. @rem Issue trace information file not found message and terminate
  81. @
  82. :error3
  83. @echo.
  84. @if exist PROC*.TRC goto error3b
  85. :error3a
  86. @echo TRACE-IT Error: %1.TRC does not exist
  87. @goto quit
  88. :error3b
  89. @echo TRACE-IT Error: %1.TRC does not exist, check for PROCxxxx.TRC
  90. @goto quit
  91. @
  92. @rem Terminate
  93. @
  94. :quit
  95.