Google
 

Trailing-Edge - PDP-10 Archives - BB-KL11J-BM_1990 - t20src/mxdbug.r36
There are 13 other files named mxdbug.r36 in the archive. Click here to see a list.
!	COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1985, 1989.
!	ALL RIGHTS RESERVED.
!
!	THIS SOFTWARE IS FURNISHED UNDER A  LICENSE AND MAY BE USED AND  COPIED
!	ONLY IN  ACCORDANCE  WITH  THE  TERMS OF  SUCH  LICENSE  AND  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.  NO  TITLE TO  AND OWNERSHIP  OF THE  SOFTWARE IS  HEREBY
!	TRANSFERRED.
!
!	THE INFORMATION IN THIS  SOFTWARE IS SUBJECT  TO CHANGE WITHOUT  NOTICE
!	AND SHOULD  NOT  BE CONSTRUED  AS  A COMMITMENT  BY  DIGITAL  EQUIPMENT
!	CORPORATION.
!
!	DIGITAL ASSUMES NO  RESPONSIBILITY FOR  THE USE OR  RELIABILITY OF  ITS
!	SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.

!++
! 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, log;

         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);

         %if $TOPS20
         %then
            SS_MESSAGE (ch$ptr (TRACE_BUFFER));
         %else
            log(TRACE_BUFFER,0)
         %fi
         end %;


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

         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);

         %if $TOPS20
         %then
            SS_CMESSAGE (ch$ptr (TRACE_BUFFER));
         %else
            log(TRACE_BUFFER,0)
         %fi
         end %;


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

         local BUFFER_PTR;

         BUFFER_PTR = ch$ptr (TRACE_BUFFER);

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

         %if $TOPS20
         %then
            SS_CLMESSAGE (ch$ptr (TRACE_BUFFER));
         %else
            log(TRACE_BUFFER,0)
         %fi
         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]