HPlogo HP-UX/HP C Compiler: HP C/HP-UX Reference Manual > Chapter 12 The Listing Facility

Listing Options

» 

Technical documentation

Complete book in PDF

 » Table of Contents

Two compiler options are provided to write additional information to the listing. The +m option is used to generate identifier maps. The +o option is used to generate code offsets.

Identifier Maps

When the +m option is specified, the compiler produces a series of identifier maps, grouped by function. The map shows the declared identifiers, their storage class, type, and address or constant value.

The first column of the map lists, in alphabetical order, the initial 20 characters of all the identifiers declared in the function. Member names of structures and unions appear indented under the structure or union name.

The second column displays the storage class of each identifier. The compiler distinguishes the following storage classes:

auto           external definition          static
constant member typedef
external register

The third column shows the type of the identifier. The types include:

array          int                unsigned char
char long int unsigned int
double long long int unsigned long
enum short int unsigned long long
float struct unsigned short
function union void

The fourth column indicates the relative register location of an identifier. Members of a union type are in the form W @ B, where W is the byte offset and B is the bit offset within the word. Both offsets are given in hexadecimal notation.

Example

main()
{
enum colors {red, green, blue} this_color;
struct SS {
char *name;
char sex;
int birthdate;
int ssn;
float gpa;
struct SS *previous;
} pupil_rec;

union UU {
int flag;
float average;
} datum;

struct SS second_pupil;

this_color = red;
pupil_rec.sex = "m";
datum.flag = 1;
second_pupil.gpa = 3.72;

}
       G L O B A L    I D E N T I F I E R    M A P

Identifier Class Type Address
- -
main ext def int () main
         L O C A L    I D E N T I F I E R    M A P S


main

Identifier Class Type Address
- -
blue const enum colors 2
datum auto union UU SP-64
flag member int 0x0 @ 0x0
average member float 0x0 @ 0x0
green const enum colors 1
pupil_rec auto struct SS SP-60
name member char * 0x0 @ 0x0
sex member char 0x4 @ 0x0
birthdate member int 0x8 @ 0x0
ssn member int 0xc @ 0x0
gpa member float 0x10 @ 0x0
previous member struct * 0x14 @ 0x0
red const enum colors 0
second_pupil auto struct SS SP-88
name member char * 0x0 @ 0x0
sex member char 0x4 @ 0x0
birthdate member int 0x8 @ 0x0
ssn member int 0xc @ 0x0
gpa member float 0x10 @ 0x0
previous member struct * 0x14 @ 0x0
this_color auto enum colors SP-36

Code Offsets

When the +o option is specified, the compiler produces a series of the code offsets for each executable statement, grouped by function. Source line numbers are given in decimal notation followed by the associated code address specified in hexadecimal notation. The code address is relative to the beginning of the function.

Example

main()
{
int j;
void func1 ();
void func2 ();

for (j=0; j&<50; j++) {
func1 (j);
func2 (j);
}
}


void func1 (i)
int i;
{
while (i &< 50) {
if (!(i % 5))
printf ("%d is divisible by 5\n", i);
i++;
}
}


void func2 (j)
int j;
{
int k, m;

k = j % 10 ? 1 : 0;
if (k) {
m = 23;
k = m * m;
}
}
                            C O D E    O F F S E T S


main "myfile.c"

Line Offset Line Offset Line Offset Line Offset Line Offset
7 8 8 18 9 20



func1 "myfile.c"

Line Offset Line Offset Line Offset Line Offset Line Offset
17 c 18 14 19 24 20 34



func2 "myfile.c"

Line Offset Line Offset Line Offset Line Offset Line Offset
30 4 31 20 32 28 33 30
© Hewlett-Packard Development Company, L.P.