|
|
When invoked with cc -g the compiler causes an entry in the object file for every source line where a breakpoint can be inserted. You can then reference line numbers when using a software debugger like sdb(CP). All line numbers in a section are grouped by function as shown in ``Line number grouping''.
Line number grouping
symbol index | 0 |
physical address | line number |
physical address | line number |
. | . |
. | . |
. | . |
symbol index | 0 |
physical address | line number |
physical address | line number |
The first entry in a function grouping has line number
0 and has, in place of the physical address,
an index into the symbol table
for the entry containing the function name.
Subsequent entries have actual line numbers and addresses of
the text corresponding to the line numbers.
The line number
entries are relative to the beginning of the function
and appear in increasing order of address.
The structure declaration currently used for line number entries is shown below.
struct lineno { union { long l_symndx; /* symtbl index of func name */ long l_paddr; /* paddr of line number */ } l_addr; unsigned short l_lnno; /* line number */ };#define LINENO struct lineno #define LINESZ 6