Skip to content

llvm-dwarfdump does not correctly dump .debug_rnglists #118161

@oltolm

Description

@oltolm

I created an exe with DWARF5 with Clang and dumped it with llvm-dwarfdump

llvm-dwarfdump.exe --debug-info --debug-rnglists bin\test_mgwhelp.exe

This is the incorrect result:

.debug_rnglists contents:
range list header: length = 0x0000001b, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
offsets: [
0x00000004
]
ranges:
[0x0000000000000031, 0x00000000000002a5)
[0x00000000000002b1, 0x0000000000000c58)
[0x0000000000000000, 0x000000000000005c)
<End of list>

The correct output is produced inline in .debug_info output:

              DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x0) rangelist = 0x00000010
                 [0x0000000140001390, 0x0000000140001604)
                 [0x0000000140001610, 0x0000000140001fb7)
                 [0x0000000140001fc0, 0x000000014000201c))

the correct raw output is produced when passing --verbose

.debug_rnglists contents:
0x00000000: range list header: length = 0x0000001b, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
offsets: [
0x00000004 => 0x00000010
]
ranges:
0x00000010: [DW_RLE_base_addressx]:  0x0000000000000031
0x00000012: [DW_RLE_offset_pair  ]:  0x0000000000000000, 0x0000000000000274 => [0x0000000000000031, 0x00000000000002a5)
0x00000016: [DW_RLE_offset_pair  ]:  0x0000000000000280, 0x0000000000000c27 => [0x00000000000002b1, 0x0000000000000c58)
0x0000001b: [DW_RLE_startx_length]:  0x0000000000000032, 0x000000000000005c => [0x0000000000000000, 0x000000000000005c)
0x0000001e: [DW_RLE_end_of_list  ]
bin\test_mgwhelp.exe:	file format COFF-x86-64

The wrong output is neither the raw output nor the one from .debug_info. I could contribute a fix that always outputs the raw contents of .debug_rnglists. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!tools:llvm-dwarfdump

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions