<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56342>56342</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            llvm-dwarfdump: CU base IP sometimes not added to rangelist offsets 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sevaa
      </td>
    </tr>
</table>

<pre>
    Consider the binary in #56339 . Run the following:

> llvm-dwarfdump-11 --debug-rnglists --verbose dwarf_v5ops.so.elf

Normally, in the verbose output the first pair of values for a rangelist entry displays the untranslated offsets, as seen in the entry, and the second pair displays the actual PC values in a loaded binary. For `DW_RLE_offset_pair` type entries like the ones in my binary, the translation involves adding the base PC of the compile unit, as seen in the top DIE's `DW_AT_low_pc` attribute.

Notice the contents of the last CU's rangelists, the one that starts at 0x000105e9 in debug_rnglists. In that CU, the first and the second pair of values are identical thoughout, as if the tool fails to find the corresponding CU and/or its  `DW_AT_low_pc`. Meanwhile, the CU is perfectly present at offset 0x6b7b9 in debug_info, and the DIE at 0x6cfac contains the DW_AT_ranges with value 0x105f5, which points right at the first rangelist in this CU's block.

The top DIE in said CU contains `DW_AT_low_pc` with value 0x4b040.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtVF1v4jAQ_DXhxSJyAoHywEMPWqnS3amqWt0j2sRO8NWxI69Dj39_aycpICFB4q-dnd2ZuLTivN1Zg0pIx_xRslIZcGemDEvyRbFaLDYsZW-9iZu11dp-KdMki8eE7xM-PRdPTOtTOxdf4GrRt908y9h8LmTZN3NnGq3QIy2cpCstShbPHU6F7TBFm0pdX8P9tq4Frc9JvgtEQuYp0Pa-6_1ARjn0rAPlmK3ZCXQvkRg6BsyBaWTIyaTxVI1Q2Gk4Y4zraQkMavBSUGSN0mPIBMhQSjNljJFx3Yi4gLKyNIwJbwCh8j1o9rqbSBACMG1BUIKhnyl7JmLJiu__HN5-Ph2GtIeARYvMn7shoaJorT5lxLVmwGrPI0pgEzYm_soGtierT3QQhCBhBg2BOkV0qC1hWtm2UzoUrvydQr3t2P7lKcnXODJ8fD-QzIeuCtzAE62y9zK9lcirSo7wxhN3nNJpoL7vPiLetxA4caei6A2eoQdHQTTi_zjnGS_kJlCKnjlMnknZixnOB8TdlfD3ZLn4AJxk5GlDLEkaf7R9Q_-pfFWPlVvNalCadLQEOyJW1jmJHaGGhu4-QqokDwIqInynRyn7JcF8HanJE0eKUsg66WpZeX1mHSESm1DuoD1VvSrX5VXJytT22m-kydCdVVVDFdsMygyWGwjE7iL7Uv441E2HqY91EWCITnVknVVBGqeaY0x-6d_lG4k-ILajZqW21eeN2O8Xl4TDCEqEAr8Z3XHNDadlyZc8nYntQmwWG5h55bXc3l4YdKMEzGjdl1eGtpVetVSdsT54mz4l0uhCevxw2ax3env0vsNwJ-XP9Gsod1-mZHuahCzja945-5fkoKlCJJfQgG64ZT47bnP-IFZlts7yh2VFLy4qnhcrWS43OWTZaqahlBq3SfEjKfYzRQF5ztc8yzk9i7ReC0ISYpWX5eZhLZIlly05Kw2JU-uamRsKJqWRNgdzf28ComqMlBM-9GRZt0V5AphFstvI9D-nWOyc">