On Tue, Mar 05, 2019 at 04:06:59PM -0500, Jason Merrill wrote: > > Assuming output_view_list_offset is correct, the following patch adjusts > > size_of_die/value_format accordingly. > > I would guess that omitting the handling from output_view_list_offset was an > oversight in the view work. Alex, which is right? :)
I had further look today. Alex has added multiple modes, with -gvariable-location-views=incompat5 the location view stuff is emitted directly into the .debug_loclist section as part of the sequence, like: .uleb128 0 # DW_AT_location (*.LLST0) ... .section .debug_loclists.dwo,"e",@progbits .long .Ldebug_loc3-.Ldebug_loc2 # Length of Location Lists .Ldebug_loc2: .value 0x5 # DWARF version number .byte 0x8 # Address Size .byte 0 # Segment Size .long 0x3 # Offset Entry Count .Ldebug_loc0: .long .LLST0-.Ldebug_loc0 .long .LLST1-.Ldebug_loc0 .long .LLST2-.Ldebug_loc0 .LLST0: .byte 0x9 # DW_LLE_view_pair .uleb128 0 # Location view begin .uleb128 .LVU6 # Location view end .byte 0x3 # DW_LLE_startx_length (*.LLST0) .uleb128 0x2 # Location list range start index (*.LVL0) .uleb128 .LVL1-.LVL0 # Location list length (*.LLST0) .uleb128 0x1 # Location expression size .byte 0x61 # DW_OP_reg17 ... .byte 0 # DW_LLE_end_of_list (*.LLST0) and in this case we don't ICE, the DW_AT_GNU_locviews attributes aren't emitted at all. With just -gvariable-location-views -gdwarf-5 -gsplit-dwarf (and the patch I've posted so that it doesn't ICE): .uleb128 0 # DW_AT_location (*.LLST0) .long .LVUS0-.Ldebug_loc0 # DW_AT_GNU_locviews ... .section .debug_loclists.dwo,"e",@progbits .long .Ldebug_loc3-.Ldebug_loc2 # Length of Location Lists .Ldebug_loc2: .value 0x5 # DWARF version number .byte 0x8 # Address Size .byte 0 # Segment Size .long 0x3 # Offset Entry Count .Ldebug_loc0: .long .LLST0-.Ldebug_loc0 .long .LLST1-.Ldebug_loc0 .long .LLST2-.Ldebug_loc0 .LVUS0: .uleb128 0 # View list begin (*.LVUS0) .uleb128 .LVU6 # View list end (*.LVUS0) .uleb128 .LVU6 # View list begin (*.LVUS0) .uleb128 0 # View list end (*.LVUS0) .LLST0: .byte 0x3 # DW_LLE_startx_length (*.LLST0) .uleb128 0x2 # Location list range start index (*.LVL0) .uleb128 .LVL1-.LVL0 # Location list length (*.LLST0) .uleb128 0x1 # Location expression size .byte 0x61 # DW_OP_reg17 .byte 0x3 # DW_LLE_startx_length (*.LLST0) .uleb128 0 # Location list range start index (*.LVL1) .uleb128 .LFE0-.LVL1 # Location list length (*.LLST0) .uleb128 0x6 # Location expression size .byte 0xa3 # DW_OP_entry_value .uleb128 0x3 .byte 0xa5 # DW_OP_regval_type .uleb128 0x11 .uleb128 0x19 .byte 0x9f # DW_OP_stack_value .byte 0 # DW_LLE_end_of_list (*.LLST0) In order to use DW_FORM_loclistx .uleb128 for the DW_AT_GNU_locviews, we'd need to emit .long .LVUS0-.Ldebug_loc0 etc. next to the .LLST0-.Ldebug_loc0 in the section offsets table at .Ldebug_loc0, but I'd expect debug info consumers to assume that anything listed in the offset table is actually a valid DW_LLE_* sequence, which is not the case for the .LVUS* labels. Note the .long .LVUS0-.Ldebug_loc0 # DW_AT_GNU_locviews looks weird, at least with the patch it is given DW_FORM_sec_offset, but because it is a difference between .LVUS0-.Ldebug_loc0, it is actually not a sec offset. Shall it use a different form in that case? Alex? Jakub