<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - llvm-dwarfdump doesn't apply Split DWARF cu_index for debug_loc.dwo"
   href="https://bugs.llvm.org/show_bug.cgi?id=38990">38990</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-dwarfdump doesn't apply Split DWARF cu_index for debug_loc.dwo
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>Wolfgang_Pieb@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dblaikie@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20888" name="attach_20888" title="Incomplete patch">attachment 20888</a> <a href="attachment.cgi?id=20888&action=edit" title="Incomplete patch">[details]</a></span>
Incomplete patch

Dumping large dwps produces a bunch of parse failures on debug_loc because the
cu_index entry for debug_loc is not accounted for when parsing the debug_loc
section.

While this example doesn't produce the error message, it does show the bug:

a.cpp:
  void y();
  void a(int i) {
    y();
    asm("" : : : "rdi");
  }

b.cpp:
  void b(int i) { asm("" : : : "rdi"); }

$ clang++-tot -gsplit-dwarf a.cpp b.cpp -c -O1 && llvm-dwp a.dwo b.dwo -o
ab.dwp && llvm-dwarfdump-tot ab.dwp | grep RDI
  Addr idx 0 (w/ length 6): DW_OP_reg5 RDI)
  Addr idx 0 (w/ length 6): DW_OP_reg5 RDI)

But run each .dwo file individually through dwarfdump:

$ llvm-dwarfdump-tot a.dwo b.dwo | grep RDI
  Addr idx 0 (w/ length 6): DW_OP_reg5 RDI)
  Addr idx 0 (w/ length 0): DW_OP_reg5 RDI)


Note the difference in length of these location list entries. This shows that
when dumping b.cpp's CU in ab.dwp, it's reading a.cpp's location list instead
of b.cpp's.

I've attached half a patch that was meant to start plumbing this through. It
isn't quite tied into the actual index lookup/offset yet - in part because of
some issues with the design there, that I'll file in a separate couple of bugs.

There's some other cleanup in this patch too - welcome to commit those parts,
or undo them, etc.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>