home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l224 / 1.img / MANUAL.ZIP / OBJXREF.DOC < prev    next >
Encoding:
Text File  |  1990-10-29  |  18.0 KB  |  535 lines

  1.  
  2.       OBJXREF: THE OBJECT MODULE CROSS-REFERENCE UTILITY
  3.       ---------------------------------------------------
  4.  
  5.  
  6. TABLE OF CONTENTS
  7. -----------------
  8. 1. What is OBJXREF?
  9. 2. How to Use OBJXREF
  10. 3. OBJXREF Options
  11. 4. OBJXREF Reports
  12. 5. OBJXREF Examples
  13. 6. OBJXREF Diagnostic Messages
  14.  
  15.  
  16. 1. WHAT IS OBJXREF?
  17. -------------------
  18.  
  19.   OBJXREF is a utility that examines a list of object files and library files 
  20.   and produces reports on their contents. One type of report lists definitions 
  21.   of public names and references to them. The other type lists the segment 
  22.   sizes defined by object modules.
  23.  
  24.   There are two categories of public names: global variables and function
  25.   names. The TEST1.ASM and TEST2.ASM files shown later in this file illustrate
  26.   definitions of public names and external references to them. 
  27.  
  28.   Object modules are object (.OBJ) files produced by TC, TCC, or TASM. A 
  29.   library (.LIB) file contains multiple object modules. An object module 
  30.   generated by TASM is given the same name as the .ASM source file it was
  31.   compiled from, unless a different output file name is specifically indicated
  32.   on the command line.
  33.  
  34.  
  35. 2. HOW TO USE OBJXREF
  36. ---------------------
  37.  
  38.   The OBJXREF command line consists of the word OBJXREF, followed by a series
  39.   of command line options and a list of object and library file names,
  40.   separated by a space or tab character. The syntax is as follows:
  41.  
  42.     OBJXREF < options >  filename < filename ... >
  43.  
  44.   The command line options determine the kind of reports OBJXREF will generate
  45.   and the amount of detail that OBJXREF will provide. They are discussed in 
  46.   more detail under Control Options and Report Options, two types of command
  47.   line options.
  48.  
  49.   Each option begins with a forward slash (/) followed by a one- or 
  50.   two-character option name.
  51.  
  52.   Object files and library files may be specified either on the command line 
  53.   or in a response file. On the command line, file names are separated by a 
  54.   space or a tab. All object modules specified as .OBJ files are included in 
  55.   reports. Like TLINK, however, OBJXREF includes only those modules from .LIB
  56.   files which contain a public name referenced by an .OBJ file or by a 
  57.   previously included module from a.LIB file.
  58.  
  59.   As a general rule, you should list all the .OBJ and .LIB files that are
  60.   needed if the program is to link correctly, including the libraries.
  61.  
  62.   File names may include a drive and directory path. The DOS ? and * wildcard 
  63.   characters may be used to identify more than one file. File names may refer 
  64.   to .OBJ object files or to .LIB library files. (If no file extension is 
  65.   given, the .OBJ extension is assumed.)
  66.  
  67.   Options and file names may occur in any order in the command line.
  68.  
  69.   OBJXREF reports are written to the DOS standard output. The default is the 
  70.   screen. The reports may be sent to a printer (as with >LPT1:) or to a file 
  71.   (as with >lstfile) with the DOS redirection character (>).
  72.  
  73.   Entering OBJXREF with no file names or options produces a summary of 
  74.   available options.
  75.  
  76.  
  77. 3. OBJXREF OPTIONS
  78. ------------------
  79.  
  80.   OBJXREF command line options fall into two categories: control options and 
  81.   report options.
  82.  
  83.   Control options
  84.   ---------------
  85.   Control options modify the default behavior of OBJXREF (the default is that 
  86.   none of these options are enabled).
  87.  
  88.   /I  Ignore case differences in public names: Use this option if you use 
  89.       TLINK without the /c option (which makes case differences significant).
  90.  
  91.   /F  Include Full library: All object modules in specified .LIB files are 
  92.       included even if no public names they contain are referenced by an 
  93.       object module being processed by OBJXREF. This provides information on 
  94.       the entire contents of a library file. 
  95.  
  96.   /V  Verbose output: Lists names of files read and displays totals of public 
  97.       names, modules, segments, and classes.
  98.  
  99.   /Z  Include Zero length segment definitions: Object modules may define a 
  100.       segment without allocating any space in it. Listing these zero length 
  101.       segment definitions normally makes the module size reports harder to 
  102.       use but it can be valuable if you are trying to remove all definitions 
  103.       of a segment.
  104.  
  105.  
  106.   Report Options
  107.   --------------
  108.   Report options govern what sort of report is generated, and the amount of 
  109.   detail OBJXREF provides.
  110.  
  111.   /RC  Report by Class Type: Module sizes ordered by class type of segment.
  112.  
  113.   /RM  Report by Module: Public names ordered by defining module.
  114.  
  115.   /RP  Report by Public Names: Public names in order with defining module name.
  116.  
  117.   /RR  Report by Reference: Public name definitions and references ordered 
  118.        by name. (This is the default if no report option is specified.)
  119.  
  120.   /RS  Report of Module Sizes: Module sizes ordered by segment name.
  121.  
  122.   /RU  Report of Unreferenced Symbol Names: Unreferenced public names ordered 
  123.        by defining module.
  124.  
  125.   /RV  Verbose Reporting: OBJXREF produces a report of every type.
  126.  
  127.   /RX  Report by External Reference: External references ordered by 
  128.        referencing module name.
  129.  
  130.  
  131.   Response Files
  132.   --------------
  133.   The command line is limited by DOS to a maximum of 128 characters. If your 
  134.   list of options and file names will exceed this limit, you must place your 
  135.   file names in a response file.
  136.  
  137.   A response file is a text file that you make with an text editor. Since you 
  138.   may already have prepared a list of the files that make up your program for 
  139.   other Turbo Assembler programs, OBJXREF recognizes several response file 
  140.   types.
  141.  
  142.   Response files are called from the command line using one of the following 
  143.   options. The response file name must follow the option without an intervening
  144.   space (/Lresp not /L resp).
  145.  
  146.   More than one response file can be specified on the command line, and 
  147.   additional .OBJ and .LIB file names may precede or follow them.
  148.  
  149.   You can create a freeform response file with a text editor. Just list the 
  150.   names of all .OBJ and .LIB files needed to make your .EXE file.
  151.  
  152.   To use freeform files with OBJXREF, type in each file name on the command 
  153.   line, preceded by an at-sign (@), and separate it from other command line 
  154.   entries with a space or tab:
  155.  
  156.     @filename  @filename ...
  157.  
  158.   Note: Any file name that is listed in the response file without an extension
  159.   is assumed to be a .OBJ file.
  160.  
  161.   Files in TLINK response file format can also be used by OBJXREF. A linker 
  162.   response file called from the command line is preceded by /L:
  163.  
  164.     /Lfilename
  165.  
  166.   To see how to use one of these files, refer to Example 2 in the
  167.   section "OBJXREF Examples" later in this file.
  168.  
  169.  
  170.   Other OBJXREF Options
  171.   ---------------------
  172.   The /D command
  173.  
  174.   If you want OBJXREF to look for .OBJ files in a directory other than the
  175.   current one, include the directory name on the command line, prefixed with 
  176.   /D:
  177.  
  178.     C:>OBJXREF/Ddir1[;dir2[;dir3]]
  179.  
  180.   or
  181.  
  182.     C:>OBJXREF/Ddir1[/Ddir2][/Ddir3]
  183.  
  184.   OBJXREF will search each of the directories in the specified order for all 
  185.   object and library files. If you don't use the /D option, only the current 
  186.   directory will be searched. However, if you use a /D option, the current 
  187.   directory will not be searched unless it is included in the directory list. 
  188.   For example, to first search the BORLAND directory for files and then search 
  189.   the current directory, you would type
  190.  
  191.     C:>OBJXREF/Dborland;
  192.  
  193.   If multiple search directories are specified, and a file matching the file 
  194.   specification is found, OBJXREF will include the file as part of the 
  195.   cross-reference. OBJXREF will only continue to search the other directories 
  196.   for the same file specification if the file specification contains wildcards.
  197.  
  198.  
  199.   The /O command
  200.  
  201.   The /O option allows you to specify an output file where OBJXREF will send 
  202.   any reports generated. It has the following syntax:
  203.  
  204.     C:>OBJXREF myfile.obj /RU
  205.     /Ofilename.ext
  206.  
  207.   By default, all output is sent to the console.
  208.  
  209.  
  210.   The /N command
  211.  
  212.   You can limit the modules, segments, classes, or public names that OBJXREF 
  213.   reports on by entering the appropriate name on the command line, prefixed 
  214.   with the /N command. For example,
  215.  
  216.     OBJXREF <filelist> /RM /NTest 
  217.  
  218.   tells OBJXREF to generate a report listing information only for the module 
  219.   named Test.
  220.  
  221.  
  222. 4. OBJXREF REPORTS
  223. ------------------
  224.  
  225.   Suppose you have two source files in your Turbo Assembler directory, and wish
  226.   to generate OBJXREF reports on the object files compiled from them. The 
  227.   source files are called TEST1.ASM and TEST2.ASM, and they look like this:
  228.  
  229.     ; TEST1.ASM
  230.  
  231.             .MODEL  small
  232.             STACK   200h
  233.             EXTRN   GOODBYE:BYTE           ;refers to Goodbye
  234.             EXTRN   SAYHELLO:NEAR          ;refers to SayHello
  235.  
  236.             PUBLIC  HELLO                  ;makes Hello public
  237.             PUBLIC  NOTUSED                ;makes NotUsed public
  238.  
  239.     .DATA
  240.     HELLO   DB      'Hello',10, 13, '$'    ;defines Hello
  241.     NOTUSED DW      ?
  242.     HIDDEN  DW      ?
  243.  
  244.     .CODE
  245.     SAYBYE  PROC    NEAR                   ;defines SayBye
  246.             mov     dx,OFFSET GOODBYE
  247.            mov     ah,9
  248.             int     21h
  249.             ret
  250.     SAYBYE  ENDP
  251.  
  252.     START   PROC    NEAR                   ;defines Start
  253.             mov     ax,@data
  254.             mov     ds,ax
  255.             call    SAYHELLO               ;refers to SayHello
  256.             call    SAYBYE                 ;refers to SayBye
  257.     EXIT:
  258.             mov     ax,04C00h
  259.             int     21h
  260.     START   ENDP
  261.     END     START
  262.  
  263.  
  264.     ; TEST2.ASM
  265.  
  266.             .MODEL  small
  267.  
  268.             EXTRN   HELLO:BYTE             ;refers to Hello
  269.   
  270.             PUBLIC  GOODBYE                ;makes Goodbye public
  271.             PUBLIC  SAYHELLO               ;makes SayHello public 
  272.     .DATA
  273.     GOODBYE DB      'Goodbye',10, 13, '$'  ;defines Goodbye
  274.  
  275.     .CODE
  276.     SAYHELLO        PROC    NEAR           ;defines SayHello
  277.             mov     dx,OFFSET HELLO        ;refers to Hello
  278.             mov     ah,9
  279.             int     21h
  280.             ret
  281.     SAYHELLO        ENDP
  282.     END
  283.  
  284.   The object modules compiled from them are TEST1.OBJ and TEST2.OBJ. You can 
  285.   tell OBJXREF what kind of report to generate about these .OBJ files by 
  286.   entering the file names on the command line, followed by a /R and a second 
  287.   letter denoting report type.
  288.  
  289.   Note: The examples that follow show only fragments of the output.
  290.  
  291.   Report by public names (/RP)
  292.   ----------------------------
  293.   A report by public names lists each of the public names defined in the 
  294.   object modules being reported on, followed by the name of the module in 
  295.   which it is defined.
  296.  
  297.   If you enter the following on the command line,
  298.  
  299.     OBJXREF  /RP  test1  test2
  300.  
  301.   OBJXREF will generate a report that looks like this:
  302.  
  303.      Symbol    Defined in
  304.  
  305.      GOODBYE   TEST2
  306.      HELLO     TEST1
  307.      NOTUSED   TEST1
  308.      SAYHELLO  TEST2
  309.  
  310.  
  311.   Report by module (/RM)
  312.   ----------------------
  313.   A report by module lists each object module being reported on, followed by a 
  314.   list of the public names defined in it.
  315.  
  316.   If you enter the following on the command line,
  317.  
  318.     OBJXREF  /RM  test1  test2
  319.  
  320.   OBJXREF will generate a report that looks like this:
  321.  
  322.     Module: TEST1 defines the following symbols:
  323.  
  324.        HELLO
  325.        NOTUSED
  326.  
  327.     Module: TEST2 defines the following symbols:
  328.  
  329.        GOODBYE
  330.        SAYHELLO
  331.  
  332.  
  333.   Report by reference (/RR) (default)
  334.   -----------------------------------
  335.   A report by reference lists each public name with the defining module in 
  336.   parentheses on the same line. Modules that refer to this public name are 
  337.   listed on following lines indented from the left margin.
  338.  
  339.   If you enter the following on the command line,
  340.  
  341.     OBJXREF  /RR  test1  test2
  342.  
  343.   OBJXREF will generate a report that looks like this:
  344.  
  345.     GOODBYE (TEST2)
  346.             TEST1
  347.     HELLO (TEST1)
  348.             TEST2
  349.     NOTUSED (TEST1)
  350.     SAYHELLO (TEST2)
  351.             TEST1
  352.  
  353.  
  354.   Report by external references (/RX)
  355.   -----------------------------------
  356.   A report by external references lists each module followed by a list of 
  357.   external references it contains.
  358.  
  359.   If you enter the following on the command line,
  360.  
  361.     OBJXREF  /RX  test1  test2  CS.LIB
  362.  
  363.   OBJXREF will generate a report that looks like this:
  364.  
  365.     Module: TEST1 references the following symbols:
  366.  
  367.       GOODBYE
  368.       SAYHELLO
  369.  
  370.     Module: TEST2 references the following:
  371.  
  372.       HELLO
  373.  
  374.  
  375.   Report of module sizes (/RS)
  376.   ----------------------------
  377.   A report by sizes lists segment names followed by a list of modules that 
  378.   define the segment. Sizes in bytes are given in decimal and hexadecimal 
  379.   notation. The word uninitialized appears where no initial values are 
  380.   assigned to any of the symbols defined in the segment. Segments defined at 
  381.   absolute addresses in a .ASM file are flagged Abs to the left of the segment
  382.   size.
  383.  
  384.   If you enter the following on the command line,
  385.  
  386.     OBJXREF  /RS  test1  test2
  387.  
  388.   OBJXREF will generate a report that looks like this:
  389.  
  390.     ;Module sizes by segment
  391.     STACK
  392.                512 (00200h)    TEST1, uninitialized
  393.                512 (00200h)    total
  394.     _DATA
  395.                 12 (0000Ch)    TEST1
  396.                 10 (0000Ah)    TEST2
  397.                 22 (00016h)    total
  398.     _TEXT
  399.                 24 (00018h)    TEST1
  400.                  8 (00008h)    TEST2
  401.                 32 (00020h)    total
  402.  
  403.  
  404.   Report by class type (/RC)
  405.   --------------------------
  406.   A report by class type lists segment size definitions by segment class. The 
  407.   CODE class contains instructions, DATA class contains initialized data and 
  408.   BSS class contains unitialized data. Segments that don't have a class type 
  409.   will be listed under the notation "No class type."
  410.  
  411.   If you enter the following on the command line,
  412.  
  413.     OBJXREF  /RC  test1  test2
  414.  
  415.   OBJXREF will generate a report that looks like this:
  416.  
  417.     ;Module sizes by class
  418.     CODE
  419.                 24 (00018h)    TEST1
  420.                  8 (00008h)    TEST2
  421.                 32 (00020h)    total
  422.     DATA
  423.                 12 (0000Ch)    TEST1
  424.                 10 (0000Ah)    TEST2
  425.                 22 (00016h)    total
  426.     STACK
  427.                512 (00200h)    TEST1, uninitialized
  428.                512 (00200h)    total
  429.  
  430.  
  431.   Report of unreferenced symbol names (/RU)
  432.   -----------------------------------------
  433.   A report of unreferenced symbol names lists modules that define public names
  434.   not referenced in other modules. Either such a symbol is referenced only 
  435.   from within the defining module and doesn't need to be defined as a public 
  436.   symbol (in that case, if the module is in C, the keyword static should be 
  437.   added to the definition; if the module is in TASM, just remove the public 
  438.   definition), or the symbol is never used (therefore, it can be deleted to 
  439.   save code or data space).
  440.  
  441.   If you enter the following on the command line,
  442.  
  443.     OBJXREF  /RU  test1  test2
  444.  
  445.   OBJXREF will generate a report that looks like this:
  446.  
  447.    Module:
  448.  
  449.        TEST1 defines the following unreferenced symbols:
  450.  
  451.        NOTUSED
  452.  
  453.  
  454.   Verbose reporting (/RV)
  455.   -----------------------
  456.   If you enter /RV on the command line, one report of each type will be 
  457.   generated.
  458.  
  459.  
  460. 5. OBJXREF EXAMPLES
  461. -------------------
  462.  
  463.   These examples assume that the application files are in the current 
  464.   directory of the default drive and that library files are in the \LIB
  465.   directory.
  466.  
  467.   Example 1   C>OBJXREF test1 test2 \lib\io.lib
  468.   ---------------------------------------------
  469.   In addition to the TEST1.OBJ and TEST2.OBJ files, the library file
  470.   \ LIB\IO.LIB is specified. Since no report type is specified, the
  471.   resulting report is the default report by reference, listing public
  472.   names and the modules that reference them.
  473.  
  474.  
  475.   Example 2   C>OBJXREF /RV /Ltest1.arf
  476.   -------------------------------------
  477.   The TLINK response file TEST1.ARF contains the same list of files as the 
  478.   command line in Example 1. The /RV option is specified so that a report of 
  479.   every type will be generated. TEST1.ARF contains
  480.  
  481.     test1 test2
  482.     test1.exe
  483.     test1.map
  484.     \lib\io
  485.  
  486.  
  487.   Example 3   C>OBJXREF /F /RV \lib\IO.lib
  488.   ----------------------------------------
  489.   This example reports on all the modules in the library file IO.LIB; OBJXREF 
  490.   can produce useful reports even when the files specified don't make a 
  491.   complete program. The /F causes all modules in IO.LIB file to be included 
  492.   in the report.
  493.  
  494.  
  495. 6. OBJXREF DIAGNOSTIC MESSAGES
  496. ------------------------------
  497.  
  498.   OBJXREF generates two sorts of diagnostic messages: error messages and 
  499.   warnings.
  500.  
  501.   Error messages
  502.   --------------
  503.   Out of memory
  504.      OBJXREF performs its cross-referencing in RAM memory and may run out
  505.      of memory even if TLINK is able to link the same list of files
  506.      successfully. When this happens, OBJXREF aborts. Remove memory-resident
  507.      programs to get more space or add more RAM.
  508.  
  509.   Warnings
  510.   ---------
  511.   WARNING: Unable to open input file rrrr
  512.      The input file rrrr could not be located or opened. OBJXREF proceeds
  513.      to the next file.
  514.  
  515.   WARNING: Unknown option - oooo
  516.      The option name oooo is not recognized by OBJXREF. OBJXREF ignores
  517.      the option.
  518.  
  519.   WARNING: Unresolved symbol nnnn in module mmmm
  520.      The public name nnnn referenced in module mmmm is not defined in any
  521.      of the .OBJ or .LIB files specified. OBJXREF flags the symbol in any
  522.      reports it generates as being referenced but not defined.
  523.  
  524.   WARNING: Invalid file specification ffff
  525.      Some part of the file name ffff is invalid. OBJXREF proceeds to the
  526.      next file.
  527.  
  528.   WARNING: No files matching ffff
  529.      The file named ffff listed on the command line or in a response file
  530.      could not be located or opened. OBJXREF skips to the next file.
  531.  
  532.   WARNING: Symbol nnnn defined in mmmm1 duplicated in mmmm2
  533.      Public name nnnn is defined in modules mmmm1 and mmmm2. OBJXREF
  534.      ignores the second definition.
  535.