Discussion of Function Offset Flags

From Dwarf Wiki
Jump to: navigation, search

I've tried to find ways to extend the dwarf line table to include new kinds of markers and flags that are associated with locations in the program code.

What I settled on as an extension is something like this. (The names have been changed from the current Sun implementation to protect the innocent.)

TAG_marker_list
   TAG_marker
       AT_marker_kind      AT_MK_green_instructions
       AT_marker_offsets   0x04, 0x1c, 0x20
   TAG_marker
       AT_marker_kind      AT_MK_blue_instructions
       AT_marker_offset    0x108, 0x210, 0x1068

The encoding for the offsets is a differentially encoded array of ULEBs. For example, the first set of numbers would be encoded as a DW_FORM_block with these numbers: ULEB(0x04) ULEB(0x18) ULEB(0x04)

This results in a much more compact representation that using the extension opcodes in the line table. It also allows a vendor extension range in the definition of the various AT_MK_xxxx values.

I'd be interested in hearing if anyone else has needed or wanted a way of defining new boolean flags associated with instructions.

The Sun compilers use this mechanism to mark the ends of prologs and the starts of epilogs, as well as different categories of memory referencing instructions to aid with our memory checking tool.