.title flipdebug flip debug-by-default bit. ;;; Ken Adelman, Caltech, [V4.4] October 1986 $dscdef $fabdef $rabdef $rmsdef .library /sys$library:lib/ $ihddef $ihadef .psect debugable,nowrt,shr,pic,long .entry debugable,^m<> clrl -(sp) pushl #! pushaq prompt pushaq 4(sp) calls #2,g^lib$get_foreign cmpl r0,#rms$_eof bneq 3$ brw done 3$: blbc r0,death $fab_store fab=exefab,- fns=(sp),fna=@4(sp) $open fab=exefab blbc r0,death cmpb exefab+fab$b_rfm,#fab$c_fix beql docon brw notexe docon: movab -512(sp),sp $rab_store rab=exerab,- rbf=(sp),ubf=(sp) $connect rab=exerab blbc r0,death $read rab=exerab blbs r0,check death: $exit_s r0 check: cmpw exerab+rab$w_rsz,#512 bneq notexev cmpw ihd$w_majorid(sp),#^a/02/ bneq notexev cmpb ihd$b_imgtype(sp),#ihd$k_exe bneq notexev bbs #ihd$v_lnknotfr,ihd$l_lnkflags(sp),noxferv cmpb ihd$w_minorid(sp),#^a/0/ bneq notexev caseb ihd$w_minorid+1(sp),#^a/1/,#4 ct: .word v2-ct .word v2-ct .word notexe-ct .word v3-ct .WORD V3-CT notexev:brb notexe noxferv: brw noxfer v2: movl #^x80000168,r1 brb ih v3: movl #sys$imgsta,r1 ih: bbsc #ihd$v_lnkdebug,ihd$l_lnkflags(sp),5$ bbcs #ihd$v_lnkdebug,ihd$l_lnkflags(sp),10$ 5$: brw write 10$: movzwl ihd$w_activoff(sp),r0 addl2 sp,r0 cmpl iha$l_tfradr1(r0),r1 beql write tstl iha$l_tfradr3(r0) bneq notclr movq iha$l_tfradr1(r0),iha$l_tfradr2(r0) movl r1,iha$l_tfradr1(r0) pushaq putvec calls #1,g^lib$put_output write: $write rab=exerab blbc r0,die1 $close fab=exefab blbc r0,die1 done: movzwl #1,r0 ret notexe: pushaq notex1 scream: calls #1,g^lib$put_output blbs r0,done die1: brw death noxfer: pushaq noxfe1 brb scream doesst: pushaq doess1 brb scream notclr: pushaq notcl1 brb scream .psect constants,nowrt,noexe,shr,long prompt: .ascid /.EXE file: / .align long notex1: .ascid /?Not an executable file/ .align long noxfe1: .ascid /?No transfer address/ .align long doess1: .ascid /?Already DEBUGable/ .align long notcl1: .ascid /?Activation section full/ .align long putvec: .ascid /DEBUG transfer vector added/ .psect exefab,wrt,noexe,long exefab:: $fab fac=,- dnm=<.EXE>,- mrs=512,- rfm=fix .psect exerab,wrt,noexe,long exerab:: $rab fab=exefab,- bkt=1,- rop=,- usz=512 .end debugable