With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000 0x0000000000000001 - 0x000000000000000b: OP_consts +3 0x000000000000000b - 0x0000000000000012: OP_consts +7 0x0000000000000012 - 0x000000000000001b: OP_reg0 RAX, OP_piece 0x00000004 0x000000000000001b - 0x0000000000000024: OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000 Addr idx 2 (w/ length 190): OP_consts +0, OP_stack_value Addr idx 3 (w/ length 23): OP_reg0 RAX, OP_piece 0x00000004)
Simple locations wihtout ranges are sumped inlie to:
DW_AT_location [DW_FORM_block1] (OP_reg4 RSI, OP_piece 0x00000004, OP_bit_piece 0x00000020 0x00000000)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
I've been sitting on this for much too long, and I'm not totally satisfied
with the code. For example, the detection of wether to use DWO or standard
lcoations in DebugInfoEntryMinimal doesn't look right. Ideas welcome (one
idea would be to have virtual DebugLoc objects and to store that in the
DWARFUnitSection, but it feels slightly over-engineered for the purpose).
The patch also isn't ready to apply as-is. It requires a few preliminary
patches like landing D6243 and adding a MCRegisterInfo in the DWARFContext,
but I've left that out here in favor of the dumping related changes.