Chapter Contents |
Previous |
Next |
Compiling C Programs |
The object
module disassembler (OMD) is a useful debugging tool that provides a copy
of the assembler code generated for a C program. If the object module is created
with a line number-offset table (that is, if the default compiler option
lineno
is in effect), then the C source code is merged with the assembler instructions.
Refer to Object Module Disassembler Options information on OMD options.
Using the OMD in TSO |
The following sections describe how to use the OMD in
TSO.
OMD370 dsname [options]
dsname is the name of the data set containing the object code to be disassembled and options are OMD options. For the data set specification, you must follow standard TSO naming conventions; that is, if the data set belongs to some other user, you must specify the full name of the data set and enclose the full name in single quotes. If the object code is in a member of a partitioned data set, you must specify the member name in parentheses following the data set name, in the normal TSO manner. For example, a data set belonging to another user can be specified as follows:
'YOURLOG.PROJ4.OBJ'
If a member name is included, the data set can be specified as follows:
'YOURLOG.PROJ4.OBJ(PART1)'
OMD370 PROJ4(PART1)
the C object code is assumed to
be in member PART1 of the data set named prefix.PROJ4.OBJ,
where prefix is the user's default prefix. You
must separate options with one or more commas, blanks, or tabs. The only
requirement is that the object data set name must be the first item on the
command line following OMD370. You can abbreviate options to the portion shown
in uppercase in Compiler Options.
To negate an option, precede it with
NO
. If you use both the positive and
negative form of an option (for example,
trans
and
notrans
), both options
are rejected.
Here is a sample command line that invokes the OMD:
OMD370 PROJ4(PART1) MER('''ADMIN.PROJ4.SOURCE''') NOTRANS
The following items discuss the sample command line:
print
is
not specified and the source data set is
not enclosed by single quotes, the listing is written to the data set userid.PROJ4.LIST.
merge
option specifies that the source for
the object
module should be read from the data set ADMIN.PROJ4.SOURCE and merged with
the OMD output. This data set belongs to another user and is therefore set
off by three quotation marks before and after the data set name.
notrans
option specifies that special characters
in the source should not be translated or overstruck when they are printed.
The OMD can be
executed as an option on the LC370 CLIST. To execute
the OMD as a part of compilation, use the option
omd
. If the compiler option
lineno
is allowed to default, the OMD produces generated assembler output merged
with the C source code. The format is as follows:
LC370 dsname [options] OMD [OMD options]
Using the OMD under CMS |
The following sections describe how to use the OMD under
CMS.
The
OMD370 EXEC invokes the object module disassembler without invoking the compiler.
You can invoke the OMD with either a CMS fileid or a SAS/C
sf:
style file identifier. The OMD370 EXEC does not accept DDnames. Invoke the
OMD using a CMS fileid with one of the following forms:
OMD370 filename [filetype] [filemode] [(options[)]] OMD370 filename.filetype[.filemode] [(options[)]]
where filename, filetype and filemode identify the TEXT file to be disassembled, and options is any of the CMS options for the OMD shown in OMD Options. If you omit the filetype or filemode, the OMD uses TEXT as the default filetype and an asterisk (*) as the default filemode.
To disassemble an object file which resides in the shared
file system, you can use OMD370 specifying a SAS/C
sf:
style file identifier, as follows:
OMD370 sf:filename [filetype] [dirname] [(options[)]]
where dirname is the complete dirname or the NAMEDEF that has been logically assigned to it, and options is any of the CMS options for the OMD list in OMD Options. If you omit filetype or dirname, the default filetype is TEXT; the default dirname is a period (.).
The OMD370 EXEC can also be used to disassemble a module
stored as a member of a TEXT library (TXTLIB). In this case, specify the
member name as the filename, and specify the TXTLIB name using the
lib
option, as in the following
example:
OMD370 myprog (lib mylib
where MYPROG is a member of MYLIB TXTLIB.
The
me
option is used to specify the fileid of the
source
file which should be merged into the OMD output. The fileid may be either
a CMS fileid or an
sf:
style file identifier. The default filetype is C.
If the
me
option is not used, OMD370 looks for the source
file on an accessed minidisk if the input fileid was a CMS fileid. If the
input fileid was a
sf:
style file identifier, it looks for the source file in the same
directory of the input file. The source file is assumed to have a filetype
of C and the same filename as the input file.
Several OMD370 options allow you to control the location
of the OMD output. The
print
option can be used to write the output to the
virtual printer, and the
type
option can be used to write the output to the
terminal.
The
pr
option allows you to specify the fileid of the
OMD's output file. The fileid may be either a CMS fileid or a SAS/C
sf:
style file identifier. The default filetype is ASM. Note that the
type
and
print
options are ignored when
pr
is specified.
If neither
print
,
type
, nor
pr
is specified, OMD370 writes its
output file to a file whose filetype is ASM and whose filename is the same
as the input file's. If the input file was specified using a CMS fileid,
the ASM file is written to the minidisk containing the input file, or to the
A-disk if the input minidisk is not writable. If the input file was specified
using a
sf:
style file identifier, the ASM file is written to the input file
directory if it is writable, or to the top directory if the input file directory
is not writable.
The OMD can be
executed as an option on the LC370 EXEC. To execute
the OMD as part of compilation, use the
omd
option. The option produces generated
assembler language output based on the compiler-produced object code. If
the
lineno
option has been used, the C source code is merged with the assembler
language statements. When the OMD option to the LC370 EXEC is used, any OMD
options also can be used.
Using the OMD under OS/390 Batch |
The following sections describe how to use the OMD under
OS/390 batch.
The
procedure LC370D runs the OMD independently of compilation. When you use LC370D,
you need DD cards for SYSLIN (your object data set), and if you are running
with the
merge
option, you need DD cards for SYSIN (your source data set). See Sample JCL for Running the LC370D Cataloged Procedure for typical
JCL. See Compiler Options for detailed information about the OMD options.
Sample JCL for Running the LC370D Cataloged Procedure
//DISASMBL JOB job card information //*--------------------------------------------------------- //* EXAMPLE JCL FOR DISASSEMBLY //* REPLACE GENERIC NAMES AS APPROPRIATE. //*--------------------------------------------------------- //STEP1 EXEC LC370D,PARM.D='options ' //D.SYSLIN DD DISP=SHR,DSN=your.object.library(member) //D.SYSIN DD DISP=SHR,DSN=your.source.library(member) //
SYSLIN or SYSIN or both may reference USS HFS files.
Expanded JCL for LC370D shows the JCL for the procedure LC370D. This JCL is correct as of the publication of this guide. However, it may be subject to change. 1ln
Expanded JCL for LC370D
//LC370D PROC //**************************************************************** //* PRODUCT: SAS/C *** //* PROCEDURE: DISASSEMBLY *** //* DOCUMENTATION: SAS/C COMPILER AND LIBRARY USER'S GUIDE *** //* FROM: SAS INSTITUTE INC., SAS CAMPUS DRIVE, CARY, NC *** //**************************************************************** //* //D EXEC PGM=LC370DM //STEPLIB DD DSN=SASC.LOAD, // DISP=SHR COMPILER LIBRARY // DD DSN=SASC.LINKLIB, // DISP=SHR RUNTIME LIBRARY //SYSTERM DD SYSOUT=A //SYSPRINT DD SYSOUT=A
This section discusses the data definition statements needed to run the OMD under OS/390 if you are writing your own JCL. As is the case with compiler options, OMD options must be given in their short forms when OMD370 is invoked directly. You need the data definition (DD) statements shown in Data Definition Statements Used by the OMD to invoke the OMD.
DDname | Purpose |
---|---|
SYSIN | C source matching the SYSLIN input |
SYSLIN | object module to be disassembled |
SYSPRINT | standard output |
SYSTERM | error output |
Sample JCL for Running the OMD illustrates how to invoke the OMD.
Sample JCL for Running the OMD
//JOBNAME JOB job card information //* //OMD EXEC PGM=OMD370,PARM='options ' //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //* //SYSIN DD DSN=your.source.library(member) ,DISP=SHR //SYSLIN DD DSN=your.object.library(member) ,DISP=SHR //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class
The OMD can be executed as an option in LC370C. To
execute the OMD as a part of compilation, use the option
omd
. If the compiler option
lineno
is allowed to default, the OMD produces generated assembler output merged
with the C source code. You can also use any OMD options, for example:
// EXEC LC370C,PARM.C='TRANS,PRINT,OMD,VERBOSE'
In this example,
trans
and
print
are compiler options,
omd
invokes the OMD after the compiler has completed, and
verbose
is an OMD option.
See Compiler Options for
more information on compiler options and OMD options.
The OMD takes seven
short-form options, as summarized in OMD Option Equivalents. The options
can be in upper- or lowercase. As with the short forms of the compiler options,
precede positive forms of the options with a hyphen (-) as the initial character;
precede negative forms with an exclamation point (!) or a not sign (
¬
).
For simplicity, the table indicates only the positive form of the option.
Refer to Compiler Options for complete descriptions of these options.
Long Form | Short Form | Long Form | Short Form |
---|---|---|---|
c
|
-c
|
japan
|
-j
|
merge
|
-s
|
overstrike
|
-to
|
trans
|
-t
|
upper
|
-u
|
verbose
|
-v
|
|
|
The following is an example of an EXEC statement that
invokes the OMD with the options
notrans
and
verbose
:
// EXEC PGM=OMD370,PARM='!T -V'
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.