Google
 

Trailing-Edge - PDP-10 Archives - BB-X117B-SB_1986 - 10,7/nml/debug.req
There are 3 other files named debug.req in the archive. Click here to see a list.
! UPD ID= 10, SNARK:<6.1.NML>DEBUG.REQ.3,  24-May-84 13:26:42 by GLINDELL
! UPD ID= 9, SNARK:<6.1.NML>DEBUG.REQ.2,  24-May-84 13:23:01 by GLINDELL
!<MCINTEE>DEBUG.REQ.2,  5-Jul-83 10:57:01, Edit by MCINTEE
!
!   Add debug flag NML_REMOTE_REQUEST
!
! PH4:<MCINTEE>DEBUG.REQ.3,  2-Jun-83 08:30:55, Edit by MCINTEE
!
!   Remove debug flag NETWORK_DESCRIPTOR. Add debug flags PRIVATE_SERVER_LINK
!   and PRIVATE_HOST_LINK. Force PRIVATE_SERVER_LINK for private world.
!   Do not force NCP_NICE_VALIDATION and SCHEDULER_TRACE.
!
! NET:<VOBA.NML.DEVELOPMENT>DEBUG.REQ.10 18-Feb-82 15:21:40, Edit by VOBA
!
!    Clean up code and update copyright date.
!
! NET:<GROSSMAN>DEBUG.REQ.3 19-Jan-82 11:18:03, Edit by GROSSMAN
!
!    Fix syntax bug in DEBUG_BITS macro. (Missing comma)
!
! NET:<BRANDT.DEVELOP>DEBUG.REQ.1  15-Jan-82 17:30:45, Edit by BRANDT
!
!    Fix %routine and %global_routine to include a %sbttl line,
!    thus making it easier to peruse listings.
!
! NET:<DECNET20-V3P1.NMU>DEBUG.REQ.8  7-Jul-81 09:40:45, Edit by JENNESS
!
!    Fix %routine and %global_routine to suppress generation of
!    literal containing routine name in MCB version (save the space).
!
! NET:<DECNET20-V3P1.NMU>DEBUG.REQ.6  2-Jul-81 19:48:28, Edit by GUNN
!
!    Add FORMAT_BUFFER macro to convert the contents of a message
!    buffer to readable text.
!
! NET:<DECNET20-V3P1.NMU>DEBUG.REQ.3  2-Jul-81 09:31:42, Edit by JENNESS
!
!    Fix DEBUG_TELL to output the debug flag mnemonic along with
!    with the feature name.
!
! NET:<DECNET20-V3P1.NMU>DEBUG.REQ.2 27-Jun-81 18:28:21, Edit by JENNESS
!
!    Add DLW_TRACE debugging flag for DATA LINK WATCHER task.
!
! NET:<DECNET20-V3P1.NMU>DEBUG.REQ.5 24-Jun-81 09:30:11, Edit by JENNESS
!
!    Add FILE_TRACE debugging flag for NMUFIL routines.
!    Add PAGE_TRACE debugging flag for NMUPAG routines.
!
!NET:<DECNET20-V3P1.NMU>DEBUG.REQ.2 12-Jun-81 13:31:31, Edit by JENNESS
!
!    Readability improvements.
!
!<DECNET20-V3P1.BASELEVEL-2.MCB>DEBUG.REQ.4 25-May-81 08:35:41, Edit by SROBINSON
!
!    Limit Text Generation in $MCB
!
!NET:<DECNET20-V3P1.NMU>DEBUG.REQ.7 20-May-81 11:28:48, Edit by JENNESS
!
!    Add TRACE_INFO_CL macro.  This appends to output previously generated
!    by a TRACE_INFO or TRACE_INFO_C macro.
!
!NET:<DECNET20-V3P1.NMU>DEBUG.REQ.2  5-May-81 10:45:48, Edit by JENNESS
!
!    Add TRACE_INFO_C macro.  This prints the same way that TRACE_INFO
!    does, except that it doesn't included the task and routine names.
!
!NET:<DECNET20-V3P1.NMU>DEBUG.REQ.3 28-Apr-81 09:06:48, Edit by JENNESS
!
!    Add check to %routine and %global_routine to undeclare %RTN_NAME
!    only if it was already declared (BLISS has gotten stricter).
!
%title 'DEBUG -- Debugging Macros And Definitions'

!                          COPYRIGHT (C) 1981 BY
!     DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS  01754
!
! THIS SOFTWARE IS FURNISHED  UNDER A LICENSE FOR USE ONLY ON A SINGLE
! COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY WITH  THE INCLUSION OF THE
! ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE, OR ANY OTHER COPIES  THEREOF
! MAY NOT BE PROVIDED OR  OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
! EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE
! TERMS.  TITLE TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES
! REMAIN IN DEC.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD  NOT BE CONSTRUED  AS A COMMITMENT  BY DIGITAL  EQUIPMENT
! CORPORATION.
!
! DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE USE OR  RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
!

!++
! Facility: LSG DECnet Network Management
!
! Abstract: This file contains definitions used for conditionalized
!	    debugging and execution tracing.
!
! Environment: Bliss-36, Bliss-32 and Bliss-16.
!
! Author: Steven M. Jenness, Creation date: 18-Mar-81
!
!--
%sbttl 'Debugging Expressions And Feature Names'

literal TRACE_BUFFER_LENGTH = 200;	! Length of buffer for TRACE_INFO


! macro: %DEBUG
!
!		This macro conditionally executes the code given
!		in the argument list.  There are two stages to
!		the conditionalization:
!
!		(1) Compile time    The code is compiled only if
!				    the VARIANT compiler switch
!				    is given with a value of 1.
!
!		(2) Run time	    The code is executed only if
!				    the expression given in the
!				    BOOLEAN field is true.  If the
!				    word ALWAYS is given instead
!				    the code will always be executed
!				    if (1) above is satisfied.
!
!    e.x.    %debug (DEBUG_TRACE, (TRACE_INFO ('Debugging is on')));


macro
     %DEBUG (BOOLEAN, CODE) =
         %if %variant eql 1
         %then %if %identical (BOOLEAN, ALWAYS)
               %then %remove (CODE)
               %else if BOOLEAN
                     then CODE
               %fi
         %fi %;


! macro: DEBUG_FLAG_SET
!
!		This macro defines all the conditions that can be
!		selected at run time for debugging.  (See %debug
!		example above for keyword usage).  The DB.xxx symbol
!		is defined as a global symbol so that debugging features
!		can be easily enabled or disabled from DDT.
!
! PRIVATE_SERVER_LINK & PRIVATE_HOST_LINK replace NETWORK_DESCRIPTOR

! PRIVATE_SERVER_LINK opens private versions of server links

! PRIVATE_HOST_LINK opens private versions of active links,
! as described in NMUT20.R36. (there are problems with this one)

! NML_REMOTE_REQUEST sends a copy of the incoming remote requests to NCP;
! the cell BUGPID must be poked to the desired PID, which may be found in 
! cell ACK%CO at runtime, after an NCP command has been issued from 
! your local OPR.

macro
     DEBUG_FLAG_SET =
         'DEBUG_TRACE',		'DB.TRA',
         'ROUTINE_TRACE',	'DB.RTN',
         'LOCAL_GALAXY',	'DB.GLX',
         'MEMORY_TRACE',	'DB.MEM',
         'MEMORY_CONSISTENCY',	'DB.MCS',
         'SCHEDULER_TRACE',	'DB.SKD',
         'EVENT_TRACE',		'DB.EVT',
         'NETWORK_TRANSITIONS',	'DB.NET',
         'NETWORK_TRACE',	'DB.NTT',
         'PRIVATE_SERVER_LINK',	'DB.SRV',
         'NCP_NICE_VALIDATION',	'DB.NCP',
         'IPCF_TRACE',		'DB.IPC',
         'FILE_TRACE',		'DB.FIL',
         'PAGE_TRACE',          'DB.PAG',
         'DLW_TRACE',           'DB.DLW',
         'FILE_DATA_TRACE',     'DB.FDT',
         'DAP_MESSAGE_TRACE',   'DB.DAP',
         'CTT_TRACE',		'DB.CTT',
	 'PRIVATE_HOST_LINK',	'DB.DCN',
	 'NML_REMOTE_REQUEST',  'DB.RRQ'
         %;
%sbttl 'Debugging Data Base'

! macro: %DEBUG_DATA_BASE
!
!		This macro is used in either an external or global
!		statement to setup the definitions to the debugging
!		data base.  This data base contains bit flags for
!		each of the debugging features.
!
!    e.x.    external %debug_data_base;


macro
     DEBUG_BIT [NAME, BIT_NAME] =
         %name (NAME, '_FLAG') = [$bit] %;

$field DEBUG_BITS =
    set
    DEBUG_BIT (DEBUG_FLAG_SET)
    tes;

literal
    DEBUG_FLAGS_SIZE = $field_set_size;

macro
     %DEBUG_DATA_BASE = 
         DEBUG : block [DEBUG_FLAGS_SIZE] field (DEBUG_BITS) %;


! macro: %MASTER_DEBUG_DATA_BASE
!
!		This macro is used in one place only in a program
!		to define the static storage needed for debugging.
!		This includes the bit flag structure (DEBUG) used
!		for feature tests and the TRACE_BUFFER used by
!		the TRACE_INFO macro.  Also the global literal bit
!		values for the debugging features are defined.
!
!    e.x.    %master_debug_data_base;


macro
     DEBUG_GLOBALS [NAME, BIT_NAME] =
         %name (BIT_NAME) = 1 ^ (%fieldexpand (%name (NAME, '_FLAG'), 1)) %;

macro
     %MASTER_DEBUG_DATA_BASE =
         global %DEBUG_DATA_BASE;
         global TRACE_BUFFER : vector [ch$allocation (TRACE_BUFFER_LENGTH)];
         global literal DEBUG_GLOBALS (DEBUG_FLAG_SET) %;
%sbttl 'Debugging Data Accesses And Setup'

! macro: FEATURE_NAME
!
!		This is a set of macros that are defined with
!		the same names as given in the DEBUG_FLAG_SET.
!		When the name is specified in some code it expands
!		to a 'fetch' of the associated bit in the debugging
!		data base.
!
!    e.x.    %debug (MEMORY_TRACE, (TRACE_INFO ('Tracing memory')));
!
!			<or>
!
!	     if MEMORY_TRACE then exitloop;


macro
     DEBUG_FLAG [NAME, BIT_NAME] =
         %name (NAME) = .DEBUG [%name (NAME, '_FLAG')] %quote % %;

macro
     %unquote DEBUG_FLAG (DEBUG_FLAG_SET);


! macro: %DEBUG_SETUP
!
!		This macro is called someplace early on in the
!		initialization of a program (in run time code).
!		The call to this is preferably in the same module
!		as the %MASTER_DEBUG_DATA_BASE macro call.  It
!		does a little hand holding for users who have forgotten
!		that the value in 135 is no longer being used for
!		debugging flags.  After the debugging data base is
!		initialized properly, the features that are enabled
!		is printed out if DEBUG_TRACE is enabled.
!
!    e.x.    %debug_setup;


macro
     DEBUG_TELL [NAME, BIT_NAME] =
         if %name (NAME)
         then TASK_INFO (%string ('	(', BIT_NAME, ') ', NAME)) %;

macro
     %DEBUG_SETUP =
         %debug (always,
                (begin
                 if .%o'135' neq 0
                 then begin
                      DEBUG[DEBUG_TRACE_FLAG] = 1;
                      DEBUG[LOCAL_GALAXY_FLAG] = 1;
                      DEBUG[PRIVATE_SERVER_LINK_FLAG] = 1;
                      end;

                 %debug (DEBUG_TRACE,
                        (begin
                         TASK_INFO ('Debugging enabled for:');
                         DEBUG_TELL (DEBUG_FLAG_SET);
                         end));
                 end)) %;
%sbttl 'Trace Message Facilities'

! macro: %MODULE_NAME
!
!		This macro declares to the tracing facility
!		the name of the module that is currently being
!		called.
!
!    e.x.    %module_name ('NMUSKD');


macro
     %MODULE_NAME (NAME) =
         %debug (always, bind %mod_name = ch$asciz (NAME)) %;


! macro: %ROUTINE
!	 %GLOBAL_ROUTINE
!
!		These macros declare to the tracing facility
!		the name of the routine that is currently being
!		executed.  The formal parameters may also
!		specified in the calls to these macros.  Note
!		that these calls must replace the normal ROUTINE
!		or GLOBAL ROUTINE declarations.
!
!    e.x.    %routine ('NMU$NETWORK_READ', LINK_ID, BUFFER_LENGTH, BUFFER) =
!
!			<or>
!
!	     %routine ('NMU$MEMORY_RELEASE') (P, AMOUNT) : novalue =


macro
     %ROUTINE (NAME) =
         %if %declared (%rtn_name)
         %then undeclare %rtn_name; %fi

         %if not $MCB
         %then bind %rtn_name = ch$asciz (NAME); %fi

         %sbttl %string (NAME %if not %identical (NAME, %string (%name (NAME)))
                              %then ,' as ', %name(NAME) %fi)
         routine %name (NAME)

         %if %length gtr 1
         %then (%remaining) %fi %;


macro
     %GLOBAL_ROUTINE (NAME) =
         %if %declared (%rtn_name)
         %then undeclare %rtn_name; %fi

         %if not $MCB
         %then bind %rtn_name = ch$asciz (NAME); %fi

         %sbttl %string (NAME %if not %identical (NAME, %string (%name (NAME)))
                              %then ,' as ', %name(NAME) %fi)

         global routine %name (NAME)

         %if %length gtr 1
         %then (%remaining) %fi %;


! macro: TRACE_INFO
!        TRACE_INFO_C
!        TRACE_INFO_CL
!
!		This macro generates a message and sends it to
!		the controlling terminal.  The message is generated
!		using the NMU$TEXT processing facility, thus the
!		message may be parameterized.
!
!		The message that results contains the currently running
!		task's name, the message specified and optionally the
!		name of the routine the TRACE_INFO was called from.
!		The routine name output is conditionallized on the
!		debugging switch ROUTINE_TRACE (DB.RTN).
!
!               The TRACE_INFO_C macro works the same as TRACE_INFO
!               except that it doesn't print the task name and routine
!               name.  It is used primarily to continue a multiple line
!               message.
!
!               The TRACE_INFO_CL macro appends output to text already
!		output by a TRACE_INFO or TRACE_INFO_C macro.
!
!    e.x.    TRACE_INFO ('This is a dumb message.');
!
!		[NML-PROCESSOR]: NMU$FILE_OPEN  This is a dumb message.
!
!
!	     TRACE_INFO ('The number is %D.', .NUMBER);
!
!		[NCP]:	NMU$IPCF_FIND	The number is 19.


macro
     TRACE_INFO (PATTERN) =
         begin
         external TRACE_BUFFER;
         external routine SS_MESSAGE, NMU$TEXT;

         local BUFFER_PTR;

         BUFFER_PTR = ch$ptr (TRACE_BUFFER);

         if ROUTINE_TRACE
         then $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                         %string ('%(22L)A ', PATTERN),
                         %rtn_name
                         %if %length gtr 1
                         %then , %remaining %fi)
         else $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                         %string (PATTERN)
                         %if %length gtr 1
                         %then , %remaining %fi);

         SS_MESSAGE (ch$ptr (TRACE_BUFFER));
         end %;


macro
     TRACE_INFO_C (PATTERN) =
         begin
         external TRACE_BUFFER;
         external routine SS_CMESSAGE, NMU$TEXT;

         local BUFFER_PTR;

         BUFFER_PTR = ch$ptr (TRACE_BUFFER);

         if ROUTINE_TRACE
         then $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                         %string ('%22S ', PATTERN)
                         %if %length gtr 1
                         %then , %remaining %fi)
         else $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                         PATTERN
                         %if %length gtr 1
                         %then , %remaining %fi);

         SS_CMESSAGE (ch$ptr (TRACE_BUFFER));
         end %;


macro
     TRACE_INFO_CL (PATTERN) =
         begin
         external TRACE_BUFFER;
         external routine SS_CLMESSAGE, NMU$TEXT;

         local BUFFER_PTR;

         BUFFER_PTR = ch$ptr (TRACE_BUFFER);

         $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                    PATTERN
                    %if %length gtr 1
                    %then , %remaining %fi);

         SS_CLMESSAGE (ch$ptr (TRACE_BUFFER));
         end %;


! macro: FORMAT_BUFFER (PATTERN, (pattern_args...), BIAS, POINTER, LENGTH)
!
!               Trace contents of a buffer


macro
     FORMAT_BUFFER (PATTERN, ARGS) =
         begin
         external TRACE_BUFFER;
         external routine SS_MESSAGE, NMU$TEXT, NMU$UTILITY_BUFFER_TEXT;

         local BUFFER_PTR;

         BUFFER_PTR = ch$ptr (TRACE_BUFFER);

         if ROUTINE_TRACE
         then $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                         %string ('%(22L)A ', PATTERN),
                         %rtn_name
                         %if %length gtr 1
                         %then , %remove(ARGS) %fi)
         else $NMU$TEXT (BUFFER_PTR, TRACE_BUFFER_LENGTH,
                         %string (PATTERN)
                         %if %length gtr 1
                         %then , %remove(ARGS) %fi);

         SS_MESSAGE (ch$ptr (TRACE_BUFFER));

         NMU$UTILITY_BUFFER_TEXT (%remaining);
         end %;
%title ''
%sbttl ''

!
! [End of DEBUG.REQ]