From:	CSBVAX::MRGATE!@KL.SRI.Com:BOB%HOWARD@cc.utah.edu@SMTP 24-AUG-1987 05:43
To:	EVERHART
Subj:	altering the /[no]debug link qualifier on an image

Received: from CC.UTAH.EDU by KL.SRI.COM with TCP; Mon 24 Aug 87 02:24:18-PDT
Date: Mon, 24 Aug 87 03:25 MST
From: BOB%HOWARD@cc.utah.edu
Subject: altering the /[no]debug link qualifier on an image
To: info-vax@KL.SRI.COM
X-VMS-To: CCA::IN%"info-vax@kl.sri.com"

These two command files change the debugger status of an image that has already
been linked. If you have an image linked without /debug then if you use 
debug.com it will modify the image header so that the debugger will be 
invoked when the image is activated. If the image was linked /debug then 
nodebug.com will cause the debugger not to be invoked. 

You might still have to disable the /traceback qualifier to get the image
activator to run the debugger. There was a command file posted to do this 
sometime back around 29-JUN-1987 by Michael J. Porter. It is also found in 
the January 1985 VAX/VMS Systems Dispatch, pp. 33-35.

These command files are useful when you want to get into an image that you
have to invoke as a foreign command (i.e. foo :== $disk:foo.exe) and can't
simply do a run/debug on it.

$! debug.com - modify the image header of an executable file so that the
$!             debugger is invoked at image activation.
$!
$! The value of IHD$L_LNKFLAGS is found in module $IHDDEF in 
$! sys$library:lib.mlb. This command procedure assumes that the 
$! value IHD$M_LNKDEBUG in $IHDDEF is 1 which could possibly change 
$! with another release of VMS.
$!
$ patch/absolute 'p1
define  IHD$L_LNKFLAGS = ^D32
examine IHD$L_LNKFLAGS
deposit IHD$L_LNKFLAGS = <\ / 2> * 2 + 1
update
exit
$ exit


$! nodebug.com - modify the image header of an executable file so that the
$!               debugger is not invoked at image activation.
$!
$! The value of IHD$L_LNKFLAGS is found in module $IHDDEF in 
$! sys$library:lib.mlb. This command procedure assumes that the 
$! value IHD$M_LNKDEBUG in $IHDDEF is 1 which could possibly change 
$! with another release of VMS.
$!
$ patch/absolute 'p1
define  IHD$L_LNKFLAGS = ^D32
examine IHD$L_LNKFLAGS
deposit IHD$L_LNKFLAGS = <\ / 2> * 2
update
exit
$ exit


I had to figure this one out the other day... hope it saves someone the effort.
It should work for VMS V4.X or until they change the image header definitions.

Bob Wheeler
Howard Hughes Medical Institute at Salt Lake City
