MAINSAIL Utilities User's Guide, Chapter 3

previous   next   top   contents   index   framed top   this page unframed


3. CHKMOD, Static Interface Consistency Checker

Temporary feature: subject to change

3.1. Introduction

CHKMOD is an interactive MODULE that shows intermodule references among MODULEs and checks interface consistency among the MODULEs before execution. This “static” interface consistency check is useful to ensure that a set of MODULEs cannot cause an interface inconsistency error at runtime.

CHKMOD works on objmods rather than source text or intmods.

Because CHKMOD has been recently introduced, its design is subject to improvement. Therefore, CHKMOD commands are subject to change.

When you run CHKMOD, you must specify a set of “source MODULEs” (“src MODULEs”) and a set of “destination MODULEs” (“dst MODULEs”). Commands are provided to add MODULEs to and remove MODULEs from each of these sets, to do some auxiliary functions such as specifying a target system, and to provide the following information:

3.2. Definition of “References

The MODULE references known to CHKMOD are compiletime references, i.e., references that the compiler is aware of. These are the references that involve a consistency check at runtime. More precisely, CHKMOD considers a MODULE M to reference a MODULE N if and only if M does one of the following:

3.3. Src MODULEs and Dst MODULEs

Many of the commands simply manipulate the src and dst MODULE sets. A src MODULE is opened and examined to obtain information about it. The entries in the src MODULE set are actually (MODULE name, file name) pairs, where the file name is the (library or object) file from which the MODULE came. A given pair can occur at most once, but the same MODULE name can occur multiple times. For example, the same MODULE could have been obtained from several different libraries, or there could be several MODULEs with the same name.

Unlike a src MODULE, a dst MODULE is not opened when it is added to the dst MODULE set since no information is obtained about it; it is just a MODULE name. Since the dst MODULE set contains MODULE names rather than (MODULE name, file name) pairs, a given MODULE name can occur at most once in the dst MODULE set.

Note that the terms “src MODULEs” and “dst MODULEs” are a bit misleading. The “src MODULEs” are not source code (they are objmods). They are not the source for any sort of copy operation, and the “dst MODULEs” are not a destination of such an operation. Furthermore, the “dst MODULEs” are not really MODULEs; they are just MODULE names, but no MODULEs of the specified names need exist. For the purposes of CHKMOD, therefore, you should think of “src MODULEs” and “dst MODULEs” as arbitrary terms that do not have their usual English meaning.

3.4. Commands to Add, Remove, and Show MODULEs

In what follows:

Commands that manipulate or show the src and dst MODULEs are:

3.5. Auxiliary Commands

Auxiliary commands are:

3.6. showAllRefs

The showAllRefs commands shows, for each src MODULE, all MODULEs that it references, as defined above. These MODULEs need not be in either src MODULEs or dst MODULEs. An example of the output is:

All references:
  
$ARYMOD (/sys.dir/sys-usp.olb)
    
$ERRMOD
    
$KERMOD
    
$TXTDIO

  
$CVRLR (/sys.dir/sys-usp.olb)
    
$ERRMOD
    
$KERMOD
    
$TARGET
    
$TXTDIO

  
$DATDIO (/sys.dir/sys-usp.olb)
    
$ERRMOD
    
$KERMOD
    
$TXTDIO

  ...

In this example, $ARYMOD references $ERRMOD, $KERMOD, and $TXTDIO; $CVRLR references $ERRMOD, $KERMOD, $TARGET, and $TXTDIO; and $DATDIO references $ERRMOD, $KERMOD, and $TXTDIO.

3.7. findRefs

The findRefs commands find all src MODULEs that reference any dst MODULE. This information could also be determined by examining the output of the showAllRefs command described above, but not as conveniently. An example of the output is (with a single dst MODULE, EDIT):

There are references to:
  
EDIT

From:
  
$DEBUG (/sys.dir/sys-usp.olb)
  
$DPYEXE (/sys.dir/sys-usp.olb)
  
BUF (/sys.dir/sys-usp.olb)
  
DATMGR (/sys.dir/sys-usp.olb)
  
DBEX (/sys.dir/sys-usp.olb)
  
E29 (/sys.dir/sys-usp.olb)
  
MAI (/sys.dir/sys-usp.olb)
  
MAINED (/sys.dir/sys-usp.olb)
  
MAINVI (/sys.dir/sys-usp.olb)
  
MEDT (/sys.dir/sys-usp.olb)
  
MTFDBG (/sys.dir/sys-usp.olb)
  
MTFEDT (/sys.dir/sys-usp.olb)
  
NULMGR (/sys.dir/sys-usp.olb)
  
NXTDIF (/sys.dir/sys-usp.olb)
  
RECOM (/sys.dir/sys-usp.olb)
  
TM9 (/sys.dir/sys-usp.olb)
  
TXTMGR (/sys.dir/sys-usp.olb)
  
UCREX (/sys.dir/sys-usp.olb)

This information could be used to determine which MODULEs need to be recompiled if a change is made to EDIT's interface, keeping in mind that this shows only those references that are known to the compiler, as explained earlier. Be aware that there could be other MODULEs that reference EDIT interface fields only through POINTERs (i.e., using the syntax pointer.field) and hence do not show up here, even though such MODULEs may also need to be recompiled if EDIT's interface were changed.

3.8. checkConsistency

The checkConsistency command reports interface inconsistencies among the src MODULEs. It also lists referenced MODULEs that are not among the src MODULEs, since CHKMOD is not able to check the interface consistency of such MODULEs.

An interface inconsistency reported as M (f) references N indicates that when the MODULE M (the one stored in the file f) was compiled, it saw a declaration of the MODULE N's interface that is incompatible with the declaration that N saw of its own interface when it was compiled. Either M or N (or both) needs to be recompiled, since one (or both) of them is out of date. Note that it is OK (and no inconsistency is reported) if M knows only about some initial part of N's interface, as long as there is not an inconsistency in this initial part; i.e., new interface fields can be added to the end of N's interface declaration without creating an interface inconsistency.

An example of the output is:

Interface inconsistencies:
  
$DEBUG (/sys.dir/sys-usp.olbreferences SHOVAL (/sys.dir/sys-usp.olb)

The following modules are referenced by one or more modules but are
not among the src modules (some may be FLI or "dummymodules):
  
FORMAT
  
PRTMOD
  
MDDIS
  
OSDCNF
  
LKUPMD
  
XXFLI
  
XTXFLI
  
XMXFLI
  
$SUNGRF
  
$MDGBL
  
$ACPUID
  
$OSDGBL
  
$SYSITF
  
$XDPYEXE

In the above example, all the “missing” MODULEs are in fact either FLI or dummy MODULEs (as established by the system PROCEDURE setModName). However, when this is not the case, any missing MODULEs that are not FLI or dummy MODULEs should be added to the src MODULE set and the consistency check carried out again.

3.9. Use of CHKMOD

It is expected that CHKMOD will be used chiefly for checking consistency among large sets of MODULEs. The exact steps for doing this are:


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Utilities User's Guide, Chapter 3