[Dwarf-discuss] dwarf information for mutiple statements at thesame line.
Cary Coutant
cary
Thu Jul 13 18:36:45 GMT 2006
On Jul 12, 2006, at 6:15 pm, Nettleton, Brian wrote:
> Debug formats I've worked with before supported this with a scheme for
> inner and outer line numbers defining a hierarchy of line numbers. I
> agree with Michael that if you've only got one number then the "outer"
> (non-macro) line number is better than an "inner" line number.
>
> Line number hierarchies are definitely something to put on the list
> for
> consideration in the next DWARF revision.
I'll offer the simple but effective scheme we use on HP-UX. We
extended the line table with two additional columns/registers:
"routine" and "context". Each is initialized to 0, and remains
unchanged when a new row is added to the table. We also maintain a
list of inlined routine names, indexed starting at 1. When "context"
is greater than 0, it indicates that the current row describes an
inner context, and "routine" is the index of the inlined routine's
name. The value of "context" refers to a preceding row in the line
table (which is indexed starting at 1) that describes the outer
context. This works to an arbitrary level of nesting.
The list of routine names is constructed by the use of the
DW_LNE_HP_define_proc opcode, which takes a null-terminated string
and adds it to the list of routine names. (Yes, I know the name of
the opcode is inconsistent with the name of the register.) We did not
add an initial list of routine names to the line number program
header (like the lists of include directories and file names).
We added the DW_LNE_HP_set_context_ref and DW_LNE_HP_set_routine_name
opcodes to set the "context" and "routine" registers. These could be
turned into DW_LNS opcodes if included in the next revision.
The "routine" register is reset to 0 by DW_LNE_end_sequence. I think
we should have also reset the "context" register, too, but we did not.
This scheme could also easily describe the original topic of this
thread, macro expansions.
-cary
More information about the Dwarf-discuss
mailing list