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

    <tr>
        <th>Summary</th>
        <td>
            lldb does not support gnu debuglink for PE/COFF files on Windows
        </td>
    </tr>

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

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

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

<pre>
    First, compile something:

```
d:\temp>clang++ -Og -g test.cpp -o test1.exe

d:\temp>lldb -a x86_64 test1
(lldb) target create --arch=x86_64 "test1"
Current executable set to 'test1' (x86_64)
(lldb) l main
File: d:\temp\test.cpp
   1    #include <cstdio>
   2
   3    int main() {
[snip]
(lldb) q
```

Then split the debugging info to a separate file:

```
d:\temp>objcopy --only-keep-debug test1.exe test1.exe.debug

d:\temp>strip --strip-debug test1.exe

d:\temp>objcopy --add-gnu-debuglink="test1.exe.debug" test1.exe
```

Now lldb does not load the debug symbols:

```
d:\temp>lldb -a x86_64 test1
(lldb) target create --arch=x86_64 "test1"
Current executable set to 'test1' (x86_64)
(lldb) l main
error: Could not find function named: "main".
(lldb) q
```

gdb loads them fine:

```
d:\temp>D:\dev\toolchain\mingw\x86_64-11.2.0-release-posix-seh-rt_v9-rev1\bin\gdb.exe test1.exe
D:\dev\toolchain\mingw\x86_64-11.2.0-release-posix-seh-rt_v9-rev1\bin\gdborig.exe: warning: Couldn't determine a path for the index cache directory.
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test1.exe...
Reading symbols from d:\temp\test1.exe.debug...
(gdb) l main
1       #include <cstdio>
2
3       int main() {
[snip]
(gdb) q
```

Using `llvm-mingw-20211002-ucrt-x86_64` toolchain from https://github.com/mstorsjo/llvm-mingw/releases/tag/20211002
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVktv2zgQ_jX2hZAgU7bjHHxI7LpYoEiLbIpiTwUljSW2FKklKTv-9ztDyq-kj81hDwv4Ib5mvvnmm6EKUx2WG2mdH_EVK03bSQXMmRZ8I3U9yu9G2XqUHX_n2fAJw4qWZysPbTfK35VK4AF-jx-WfKxZUjMPzqdl17HEhOdJCs9wafDaglJVwRLBnhfzr_NpPDHs5gtaHPFb5oWtwbPSgvDAkkTYshnl6-HMiPN4jPN4ctVbC9ozdFz2XhQUHR73BrfeDFtv8HkRDaCHVx4Va4XUcXqD9CBmdgmc_mKccQ9jbIJfNJpLXaq-AjbKV6XzlTQY5WkTPz3ltF0iyuCIL8jr6OZ-QDK7d1qim_UrZH__MC3x96kBzVynJAbbAKug6OsaU4p-tobiF0hEJyyxuI1R_etUm-JbaboDsm-0OiTfAbokODhn-fyUhpWfZ915K1EhSfh_aebnx84YRFUlte7jUSX1d5TDUQcXADh_ZfZHvD2YPQtCrAw4po1nyojqzCFzh7Ywyr2Fr_-BsMFaY0nZK9OrKsS9lbpi216XXhrNtGiBoiIkUaY8fZMga-SAqHTEZUvW36S5dRxVsKM5Y1TZEIrZqkVR7_E_xplMJilPs8SCAuEg6YyTz4mDJrH-6-4W53cT3FyEowjpWqvR8X_kylhZBydI4l5YHftrJFxT0lBgHiw6ASzOTviGbY0NysNMwDMrRUkqlBZKb-xhoP_9w2dG3GIa3q_vKQuTLD2KBCsEvTaeVle0xjM-YRsLwP40W48wgG1MrytBSaY74A9dDoY_yBK0A_b-04ddTo0dwZIzHLMdWEeqyB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