home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / vms / 19518 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  3.4 KB

  1. Path: sparky!uunet!pipex!warwick!uknet!tss!mors
  2. From: mors@tessella.co.uk (Stephen Morris)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: How do you RUN a program with parameters?
  5. Message-ID: <BzG92D.7tE@tessella.co.uk>
  6. Date: 18 Dec 92 09:59:01 GMT
  7. References: <11DEC92.00050417@meena.cc.uregina.ca> <Bz3BAr.ADu@dscomsa.desy.de> <1ga33pINN8jn@nz12.rz.uni-karlsruhe.de>
  8. Sender: Stephen Morris (mors@tessella.co.uk)
  9. Organization: Tessella Support Services plc, Abingdon, England
  10. Lines: 93
  11.  
  12. In article <1ga33pINN8jn@nz12.rz.uni-karlsruhe.de> 
  13. DAHMS@ifk20.mach.uni-karlsruhe.de (Heribert Dahms) writes:
  14.  
  15. >And now my question:
  16. >====================
  17. >
  18. >How can I force like RUN/DEBUG or RUN/NODEBUG ?
  19. >I usually compile and link with /DEBUG but sometimes want to prevent debugger
  20. >startup. I don't want to patch flags in the image file.
  21. >Can I write a jacket program which accepts /[NO]DEBUG and starts the image
  22. >named by the first argument accordingly and passes remaining arguments?
  23. >The routines LIB$RUN_PROGRAM or LIB$FIND_IMAGE_SYMBOL don't seem fitting to me.
  24. >i.e.
  25. >    $ ccrun := $disk:[directory]ccrun
  26. >    $ ccrun/nodebug myprogfilename <Pass this rest of line as args>
  27. >
  28. >
  29. >Thanks, Heribert (dahms@ifk20.mach.uni-karlsruhe.de)
  30.  
  31. I had a similar problem, in that I was working on a large program, which took
  32. ages to start up if it was LINKed/DEBUG.  I came up with the following
  33. solution, which allowed me to "switch off" the debugger.
  34.  
  35. Regards,
  36. Stephen Morris (mors@tessella.co.uk)
  37. (Standard disclaimers apply)
  38.  
  39.     .TITLE NULL_DEBUGGER
  40. ;+
  41. ; Description:
  42. ;    If a program is LINK/DEBUGged, VMS will automatically invoke the
  43. ;    debugger when the program is run.  Although the debugger can be
  44. ;    inhibited by a RUN/NODEBUG, this is not always possible (e.g. if the
  45. ;    program if invoked via a DCL command).
  46. ;
  47. ;    NULL_DEBUGGER can take the place of the VMS debugger in these
  48. ;    circumstances, and allow the program to run as if the debug flag was
  49. ;    not set.
  50. ;
  51. ;    To build NULL_DEBUGGER, issue the following commands:
  52. ;
  53. ;        $ MACRO NULL_DEBUGGER
  54. ;        $ LINK/SHARE NULL_DEBUGGER,SYS$INPUT:/OPTIONS
  55. ;        BASE=0
  56. ;        ^Z
  57. ;
  58. ;    To use the null debugger, define the logical name LIB$DEBUG to be the
  59. ;    image NULL_DEBUGGER.EXE, then run the program as normal.
  60. ;
  61. ; Author:
  62. ;    S. A. Morris     October 1988
  63. ;-
  64.  
  65. ; Size of data areas.
  66.  
  67. XFRVEC_SIZE = <4 * 4>            ; Transfer vector array size
  68. ARGLST_SIZE = <7 * 4>            ; Argument list size
  69. BYTES_RESERVED = XFRVEC_SIZE + ARGLST_SIZE
  70.  
  71. ; Offsets in stack data area. These offsets are from the location of the frame
  72. ; pointer (FP).
  73.  
  74. XFRVEC = - XFRVEC_SIZE
  75. ARGLST = XFRVEC - ARGLST_SIZE
  76.  
  77. ; Declare the debugger data structures.
  78.  
  79.     .PSECT    CODE EXE,NOWRT
  80.  
  81.     .LONG    0            ; Ignored (?)
  82.     .LONG    0            ; Ignored (?)
  83.     .ADDRESS NULL_DEBUGGER+2    ; Transfer address
  84.  
  85.     .ENTRY NULL_DEBUGGER ^M<R2,R3,R4,R5>
  86.     SUBL2    #BYTES_RESERVED,SP    ; Reserve space on stack for data
  87.  
  88. ; Set up the new transfer vector array, with the debugger address removed.
  89.  
  90.     MOVL    4(AP),R0        ; Transfer vector array address
  91.     MOVQ    4(R0),XFRVEC(FP)    ; 2nd and 3rd -> 1st and 2nd addresses
  92.     MOVL    8(R0),XFRVEC+8(FP)    ; 4th -> 3rd address
  93.     CLRL    XFRVEC+12(FP)        ; Zero a new 4th address
  94.  
  95. ; Set up the new argument list for the program. This is identical to the
  96. ; argument list passed here, but with the transfer vector array address
  97. ; replaced.
  98.  
  99.     MOVC3    #ARGLST_SIZE,(AP),ARGLST(FP) ; Move argument list across
  100.     MOVAL    XFRVEC(FP),ARGLST+4(FP)    ; Set new transfer vector array
  101.     CALLG    ARGLST(FP),@XFRVEC(FP)    ; Transfer control to program
  102.     RET                ; Return to caller
  103.  
  104.     .END NULL_DEBUGGER
  105.