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

    <tr>
        <th>Summary</th>
        <td>
            DWARF with -gmlt and -flto is missing name-mangled C++ symbol names for inlined functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    This is part of https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883 (DWARF symbols are missing the full C++ name-mangled info when built with `-gmlt`).

I initially fixed https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883 by falling back to the STABS table (which has the full C++ name-mangled version of the symbol) when the symbol name stored in DWARF doesn't match the STABS name:

https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4453650

However, that technique doesn't work for inlined functions — they have no entry in the STABS table, so the name-mangled C++ information is simply missing, causing all sorts of challenges e.g. with clustering symbolicated crash traces (you have to handle both the fully name-mangled C++ version as well as the minimal C-style symbol name which is missing namespace and type information).

Here's a repro:

https://gist.github.com/bhamiltoncx/83895a77882c96c081d200cf37505036

You can see the symbol information for `foo::f()` is present in the STABS (since it's marked `noinline`), but `foo::g()` and `foo::h()` are not present in STABS.

In addition, the minimal DWARF information is missing the namespace and type info for `foo::g()` and `foo::h()`:

```
0x00000043:   DW_TAG_subprogram
                DW_AT_name      ("g")
                DW_AT_inline    (DW_INL_inlined)

0x00000049:   DW_TAG_subprogram
                DW_AT_name      ("h")
                DW_AT_inline    (DW_INL_inlined)

0x00000060:     DW_TAG_inlined_subroutine
                  DW_AT_abstract_origin (0x0000000000000049 "h")
                  DW_AT_low_pc  (0x0000000100003f80)
                  DW_AT_high_pc (0x0000000100003f84)
                  DW_AT_call_file       ("/Users/benhamilton/test.cc")
                  DW_AT_call_line       (21)
                  DW_AT_call_column     (0x03)

0x00000074:       DW_TAG_inlined_subroutine
                    DW_AT_abstract_origin       (0x0000000000000043 "g")
                    DW_AT_low_pc        (0x0000000100003f80)
                    DW_AT_high_pc       (0x0000000100003f84)
                    DW_AT_call_file     ("/Users/benhamilton/test.cc")
                    DW_AT_call_line     (15)
                    DW_AT_call_column   (0x03)
```

I think we'll need to use the name-mangled symbol for inlined functions, since there's no representation of the symbol in the STABS to fall back on in this case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0V09v47YT_TT0ZWBDov5YOvjgxD__doGih26KoCeDokYSG4p0SSpef_uClL2Wvckm7TZC4CQSZzjz3tPwmVkrWoW4ItkdyTYzNrhOm1XVsV5IpxX_Oqt0fVw9dMKCsLBnxoFuoHNub0myJnRL6LYaWrvgndG9GPqFNi2h2z2h21brVuK8Msie9qwmdCusHdASuq3RMSFJshU1STZFkQChxeZx_dsW7LGvtLTADEIvrBWqBdchNIOUcE_oHaF3oFiP856pVmINQjUaDh0qqAYhHRyE64Dk0bztpSN5RGi5INGGROvx8zMIJZxgUh6hEV-x_oh-qiM0TEpffcX4EzgduvjysL77Ao5VEn3Lh07wDjpm32jxGY0VWnns_cIRI0LLse3LrRAF1mkTcIER0lqjVYQuHfTM8W5SiF_u-56gc43FGYa5wWeBh8WIgdWD4bjguvdLPGQXTCZ_hk62aZoleRZN9_ikD_iMhtB7cB1z4JB3Svw14KTUgzZP0GgDQkmhsIZmUNwJrSyQ_1FSRKRMfSdH6NgzgtKAypmj7_oGaL-NHeG_AvWMtNeP6ZnP7UVuRb-Xx7P2fDBnQ5AhkxKsNs56HnjHpETVogVctItRdVwO1qHxi0dCBGcOa-CG2Q6cYRyt5_2oh7Fsp6FjqpYIlXbdNxUcX670LANm4YBSwkk3vVCiZxLu59Yd5bUWRoUJ--1d8nftnnEEpmpwxz1OAbh9Vz6hQUKXFhgY3Bv9Q7G0wrpFK1w3VCdtTCYJodsiKcqMLZdFQXmZ86iIaxpFvEmWWZRFST7N_IcegDMFFnGq7yl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