[Dwarf-discuss] dwarf information for mutiple statements at the same line.

David Anderson davea
Fri Jun 23 16:46:13 GMT 2006

>I have a question about how dwarf deals with multiple statements at one
>line. For example, suppose there is code
>f1(); f2();
>at the same line in the source code. In the binary, there
>should be two call instructions corresponding to these
>two statements. However, it seems that dwarf only provides
>mapping between line number to instruction address.


>Is it possible to map these two different call statements at
>the same line to the corresponding binary instructions?

In the dwarf 'line table' each entry is composed of a
file number, a line-number, and an offset.
The offset being the offset within the line of the source 

In other words, the entries for the above might be
	1 100 1
	1 100 7

if it is line 100 in the source file whose table number is 1
and the f1 is at column 1 and the f2 is at column 7.

See section 6.2, "Line Number Information" of the DWARF3
document for the
conceptual and physical details of line entries.
(essentially the same as in DWARF2)

It's up to the compiler to emit the offset-within-source-line 
and debugger to make something useful of it, of course...

Hope this helps.
David Anderson

More information about the Dwarf-discuss mailing list