<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-symbolizer does not support .gnu_debugaltlink"
   href="https://bugs.llvm.org/show_bug.cgi?id=47537">47537</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-symbolizer does not support .gnu_debugaltlink
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

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

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

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

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>iii@linux.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I noticed that llvm-symbolizer fails to fully symbolize python3-related
backtraces on s390x Fedora 31. I tracked this down to lack of .gnu_debugaltlink
support, so I'm fairly confident the problem occurs on other architectures as
well.

For example:

$ llvm-project/build/bin/llvm-symbolizer -e /usr/lib64/libpython3.7m.so.1.0
0x3fffcf998c3 --adjust-vma 0x3fffcf00000
??
/usr/src/debug/python3-3.7.4-5.fc31.s390x/Objects/obmalloc.c:1585:11
??
/usr/src/debug/python3-3.7.4-5.fc31.s390x/Objects/obmalloc.c:1577:1

Surprisingly, llvm-symbolizer shows the correct source code lines, but no
function names.

If we extract relevant DIE offsets with the debugger and dig into libpython3
debuginfo, we'll see:

 <1><25eac>: Abbrev Number: 40 (DW_TAG_subprogram)
    <25ead>   DW_AT_abstract_origin: <alt 0x10f7a>
    <25eb1>   DW_AT_low_pc      : 0x99850
    <25eb9>   DW_AT_high_pc     : 148
    <25ebb>   DW_AT_frame_base  : 1 byte block: 9c      (DW_OP_call_frame_cfa)
    <25ebd>   DW_AT_GNU_all_call_sites: 1
    <25ebd>   DW_AT_sibling     : <0x25f58>

DW_AT_abstract_origin points to <alt 0x10f7a>, so the target DIE is in a file
pointed to by .gnu_debugaltlink. As far as I understand, dwz produces these
when deduplicating debuginfo.

And indeed:

Contents of section .gnu_debugaltlink:
 0000 2e2e2f2e 2e2f2e64 777a2f70 7974686f  ../../.dwz/pytho
 0010 6e332d33 2e372e34 2d352e66 6333312e  n3-3.7.4-5.fc31.
 0020 73333930 7800467e 07ea9a25 a5feb0ca  s390x.F~...%....
 0030 82f3ed5f 3ebb73aa 698e               ..._>.s.i.      

If we look into
/usr/lib/debug/usr/lib64/libpython3.7m.so.1.0-3.7.4-5.fc31.s390x.debug, we'll
find:

 <1><10f7a>: Abbrev Number: 26 (DW_TAG_subprogram)
    <10f7b>   DW_AT_name        : (indirect string, offset: 0x19edc):
_PyObject_Malloc
    <10f7f>   DW_AT_decl_file   : 200
    <10f80>   DW_AT_decl_line   : 1577
    <10f82>   DW_AT_decl_column : 1
    <10f83>   DW_AT_prototyped  : 1
    <10f83>   DW_AT_type        : <0x52df7>
    <10f87>   DW_AT_sibling     : <0x10fb1>

_PyObject_Malloc is exactly the missing function name.

It would be great if .gnu_debugaltlink support could be added to
llvm-symbolizer. I see that lldb already has it.</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>