/********************************* * * * PL/I symbolic debugger main * * * *********************************/ debmain: procedure options(main); %include 'putdef.pli'; /* we include these to make sure external variables are in the root. */ %include 'scandef.pli'; %include 'knldef.pli'; %include 'exitdef.pli'; %include 'workdef.pli'; %include 'symdef.pli'; %include 'moddef.pli'; %include 'segdef.pli'; %include 'brksymdef.pli'; %include 'breakdef.pli'; %include 'statement.inc'; %include 'rundef.pli'; %include 'mapdef.pli'; %include 'initdef.pli'; dcl (oncode, onloc) builtin; /* event flags allocation: */ dcl RCVEVF fixed bin(15) external initial(2), /*define for RCVEVE & rcvknl*/ exit_event fixed bin(15) external initial(3), /*for rcvknl, also debfinish*/ mcr_event fixed bin(15) external initial(4), /*for debinit, **temp also for debfinish, mcrprv*/ qio_event fixed bin(15) external initial(5), /*for tiqio*/ time_event fixed bin(15) external initial(6); /*for debfinish*/ /**************************************************************************************************************/ /******************** * Initialization * ********************/ on error begin; dcl x fixed bin(15) static; /**temp*/ x = oncode; /**temp put in variable for PL/I bug*/ call put_skip_list('error in debugger, oncode =',x,', onloc =',onloc(),', debugger exiting'); debug_exit_status = EX_ERR; /*PL/I automatically signals finish, so user task gets aborted & removed*/ end; on finish call debfinish; /*it's in overlay to conserve space in root*/ call debinit; /* the following cannot be in debinit because they invoke modules that overlay it. they automatically provide the user with accessability established to an activated main procedure. (the debugger gains control before any PL/I initialization - at this point there is no PL/I environment and the user's main procedure automatic variables do not exist). note that these commands have special code for this initialization sequence. */ commandline = 'SET MODULE '!!userpgmname; call do_command; commandline = 'SET BREAK 2'; /*first statement inside main procedure (statement 1 is before activation)*/ call do_command; commandline = 'GO'; call do_command; commandline = 'CANCEL BREAK 2'; call do_command; initializing = false; /**PL/I runtime forces us to move this to do_command - for some reason it deletes the endcmd on-unit... on transmit(workfile) call error('transmit on debugger workfile, oncode='!!oncode); on endfile(workfile) call error('endfile on debugger workfile'); ********/ /****************** * Command Loop * ******************/ do while(true); on endfile(includefile) begin; close file(includefile); call pop_scan_state; nextp = - nextp; /*negative so that do_command doesnt set to 1 **temp?**/ goto docommand; end; next_command: call chkknl; /*dont wait for command if user task aborted*/ if in_include then read file(includefile) into(commandline); else if scan_state_nesting_level ^= 0 then call workread(commandline,debprocedure_workp); /*in do-group or debprocedure*/ else call edit_command; /*get command from user interactively*/ (nostringrange): if substr(commandline,1,1) = '!' then goto next_command; /*skip comment*/ if debprocedure_define_level ^= 0 then do; /*if defining do-group or debprocedure, write to work file*/ call workswitch(put_workp); work_debprocedure_line_pos = current_fileaddr(workfile); /*save position to back up to if there's an error*/ call workwrite(commandline); end; docommand: call do_command; end; /*of command loop*/ end debmain;