...UWDIMGSTA]000READ.ME
-----------------------
If you ever got tired of DEBUG coming up automatically, then these
files are for you!  The first, UWDIMGSTA, changes the default operation
of the RUN command fron /DEBUG to /NODEBUG.  This means you must do a
RUN/DEBUG to get the debugger to start.  Your only VMS-provided option
is to LINK/TRACE, but not /DEBUG.  This has the unfortunate side-effect
of not including a debug symbol table (DST).  Without the DST, even if
you do a ^Y-DEBUG, your source is not accessible.

***
*** ALWAYS SAVE A BACKUP COPY OF ANYTHING YOU TOUCH WITH PATCH ***
***

The second method is th LINK/DEBUG in the standard way, but PATCH the
resulting image to tell the image activator that the debugger is not
linked in, and therefore, do not initialize it.  This function is
provided in DEBUGON.COM, and DEBUGOFF.COM.

A third issue one might wish to address is that of causing an image to
enter the debugger that was linked /NOTRACE.  This is accomplished by
patching the address of SYS$IMGSTA into the transfer array just as if
the image had been linked /TRACE.  Then you use the above utilities to
turn on the 'linked_with_debug' bit, run your program, and bingo! --->
DBG>  !No source of course, but the on-screen disassembly, and instruction
modes are a start.  ADDDEBUG.COM provides this function.  Also provided
is a DEBUG.INI file I like & use.  It's not for everyone, and it has some
drawbacks (mostly due to limited screen space), but it's the best I've
been able to come up with.

UWDIMGSTA:
  This module offers the user a method to call SYS$IMGSTA correctly
  from an image which is targeted for INSTALL with /PRIV=, or
  /EXECUTE_ONLY.  This is accomplished by *NOT ALLOWING* the address
  of SYS$IMGSTA to appear in the image transfer address array.  To
  get the linker to properly construct the transfer array, you must
  link your target image using /DEBUG=UWDIMGSTA.  The transfer array will
  then vector first to this routine and then (indirectly) to your
  module's main entry point via SYS$IMGSTA.  Note that this is accomplished
  very delicately by evaporating the initial call frame, creating an
  RSB address on the stack and re-calling SYS$IMGSTA with the original
  arguments passed by $IMGACT.  Additionally, the args from $IMGACT are
  chewed upon such that the user must now do a $ RUN/DEBUG <pgm> in order
  to actually invoke the debugger.  (Note also that this behaviour is blocked
  for install/priv=... images because of potential security issues).

  As the code stands now, a privileged user may use this module to bypass
  INSTALL's check to see if the image was linked /TRACEBACK.  The command
  RUN/DEBUG will be disabled for installed images, but ^Y-DEBUG may still
  work (I think I remember researching this & finding that it won't though).
  At least the program *will* traceback on an exception.  If you have need to
  DEBUG an image installed /priv or /execute_only from a non-privileged
  account, this code could be modified to allow that.

  Warning to system administrators/managers: If you have users developing
  programs that will be installed with privileges, this code would provide
  an inconspicuous way to build in a trapdoor function.  Either link the
  developer's image yourself, or use ANALYZE/IMAGE to look at the transfer
  array (there should be only one address!).

DEBUGON.COM, DEBUGOFF.COM:
  These .COM files patch the 'linked_with_debug' bit on or off.  This allows
  a user to link an image /DEBUG, but 'fix' it so it doesn't auto-start
  the debugger.

ADDDEBUG.COM:
  Inserts SYS$IMGSTA address to an image's transfer array.  Do an
  ANALYZE/IMAGE and make sure you have only a single non-zero address
  before running this against an image.

DEBUG.INI:
  FYI debug init file I like & use.
