<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58164>58164</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Zig produced PDB debug info crashes LLDB 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>
jarek-przygodzki
</td>
</tr>
</table>
<pre>
Debugging a hello-world Zig application (`zig init-exe`, Zig version 0.10.0-dev.4213+91b05ad47) using lldb version 15.0.1 on Windows does not work.
Symbols are not picked up automatically, and attempt to add them manually fails with `Assertion failed: (obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS)`
```
PS C:\projects\Zig\hello-world> &"$env:LLVM_HOME\bin\lldb.exe" zig-out\bin\hello-world.exe
(lldb) target create "zig-out\\bin\\hello-world.exe"
(lldb) Current executable set to 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.exe' (x86_64).
(lldb) add-dsym zig-out\bin\hello-world.pdb
Assertion failed: (obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS), function InitializeObject, file C:\src\llvm_package_15.0.1\llvm-project\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp, line 199
backtrace leading to the failure:
please file a bug report against lldb reporting this failure log, and as many details as possible
symbol file 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.pdb' has been added to 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.exe'
```
With `LLDB_USE_NATIVE_PDB_READER="yes"` symbols can be loaded
```
PS C:\projects\Zig\hello-world> $env:LLDB_USE_NATIVE_PDB_READER="yes"
PS C:\projects\Zig\hello-world> &"$env:LLVM_HOME\bin\lldb.exe" zig-out\bin\hello-world.exe
(lldb) target create "zig-out\\bin\\hello-world.exe"
(lldb) Current executable set to 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.exe' (x86_64).
(lldb) add-dsym zig-out\bin\hello-world.pdb
symbol file 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.pdb' has been added to 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.exe'
(lldb) image lookup -n main
1 match found in C:\projects\Zig\hello-world\zig-out\bin\hello-world.exe:
Address: hello-world.exe[0x00000001400015c0] (hello-world.exe..text + 1472)
Summary: hello-world.exe`main at main.zig:3
(lldb) l main
File: C:\projects\Zig\hello-world\src\main.zig
1 const std = @import("std");
2
3 pub fn main() !void {
4 // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
5 std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
6
7 // stdout is for the actual output of your application, for example if you
8 // are implementing gzip, then only the compressed bytes should be sent to
9 // stdout, not any debugging messages.
10 const stdout_file = std.io.getStdOut().writer();
11 var bw = std.io.bufferedWriter(stdout_file);
```
But lldb crashes when reaching an breakpoint
```
(lldb) b main
Breakpoint 1: where = hello-world.exe`main + 26 at main.zig:5, address = 0x00000001400015da
(lldb) run
(lldb) Process 40128 launched: 'C:\projects\Zig\hello-world\zig-out\bin\hello-world.exe' (x86_64)PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Exception Code: 0xC0000005
(lldb) #0 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x296898 C:\Program Files\LLVM\bin\liblldb.dll 0xc30ae7
#1 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x22b2cc C:\Program Files\LLVM\bin\liblldb.dll 0x1fcbe5
#2 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x1fcaa7 C:\Program Files\LLVM\bin\liblldb.dll 0x1b9e7d1
#3 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x1b9d5ed C:\Program Files\LLVM\bin\liblldb.dll 0x987c32
#4 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x9876e3 C:\Program Files\LLVM\bin\liblldb.dll 0x9879ae
#5 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x987609 C:\Program Files\LLVM\bin\liblldb.dll 0x98814d
#6 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x96b990 C:\Program Files\LLVM\bin\liblldb.dll 0x96d8d5
#7 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x96e34e C:\Program Files\LLVM\bin\liblldb.dll 0x328bc1
#8 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x462209 C:\Program Files\LLVM\bin\liblldb.dll 0x2dc3cc
#9 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x2d74ce C:\Program Files\LLVM\bin\liblldb.dll 0x2dd375
#10 0x00007ffb16cf6898 C:\Program Files\LLVM\bin\liblldb.dll 0x2e6004 C:\Program Files\LLVM\bin\liblldb.dll 0x8ab274
#11 0x00007ffb16cf6898 (C:\Program Files\LLVM\bin\liblldb.dll+0x296898)
#12 0x00007ffb17690ae7 (C:\Program Files\LLVM\bin\liblldb.dll+0xc30ae7)
#13 0x00007ffb16c8b2cc (C:\Program Files\LLVM\bin\liblldb.dll+0x22b2cc)
0x00007FFB16CF6898, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x296898 byte(s), PyInit__lldb() + 0x1ADA98 byte(s)
0x00007FFB17690AE7, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0xC30AE7 byte(s), PyInit__lldb() + 0xB47CE7 byte(s)
0x00007FFB16C8B2CC, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x22B2CC byte(s), PyInit__lldb() + 0x1424CC byte(s)
0x00007FFB16C5CBE5, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x1FCBE5 byte(s), PyInit__lldb() + 0x113DE5 byte(s)
0x00007FFB16C5CAA7, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x1FCAA7 byte(s), PyInit__lldb() + 0x113CA7 byte(s)
0x00007FFB185FE7D1, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x1B9E7D1 byte(s), PyInit__lldb() + 0x1AB59D1 byte(s)
0x00007FFB185FD5ED, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x1B9D5ED byte(s), PyInit__lldb() + 0x1AB47ED byte(s)
0x00007FFB173E7C32, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x987C32 byte(s), PyInit__lldb() + 0x89EE32 byte(s)
0x00007FFB173E76E3, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x9876E3 byte(s), PyInit__lldb() + 0x89E8E3 byte(s)
0x00007FFB173E79AE, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x9879AE byte(s), PyInit__lldb() + 0x89EBAE byte(s)
0x00007FFB173E7609, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x987609 byte(s), PyInit__lldb() + 0x89E809 byte(s)
0x00007FFB173E814D, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x98814D byte(s), PyInit__lldb() + 0x89F34D byte(s)
0x00007FFB173CB990, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x96B990 byte(s), PyInit__lldb() + 0x882B90 byte(s)
0x00007FFB173CD8D5, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x96D8D5 byte(s), PyInit__lldb() + 0x884AD5 byte(s)
0x00007FFB173CE34E, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x96E34E byte(s), PyInit__lldb() + 0x88554E byte(s)
0x00007FFB16D88BC1, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x328BC1 byte(s), PyInit__lldb() + 0x23FDC1 byte(s)
0x00007FFB16EC2209, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x462209 byte(s), PyInit__lldb() + 0x379409 byte(s)
0x00007FFB16D3C3CC, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x2DC3CC byte(s), PyInit__lldb() + 0x1F35CC byte(s)
0x00007FFB16D374CE, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x2D74CE byte(s), PyInit__lldb() + 0x1EE6CE byte(s)
0x00007FFB16D3D375, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x2DD375 byte(s), PyInit__lldb() + 0x1F4575 byte(s)
0x00007FFB16D46004, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x2E6004 byte(s), PyInit__lldb() + 0x1FD204 byte(s)
0x00007FFB1730B274, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFB16A60000) + 0x8AB274 byte(s), PyInit__lldb() + 0x7C2474 byte(s)
0x00007FFBF1341BB2, C:\WINDOWS\System32\ucrtbase.dll(0x00007FFBF1320000) + 0x21BB2 byte(s), _configthreadlocale() + 0x92 byte(s)
0x00007FFBF39C7034, C:\WINDOWS\System32\KERNEL32.DLL(0x00007FFBF39B0000) + 0x17034 byte(s), BaseThreadInitThunk() + 0x14 byte(s)
0x00007FFBF3C826A1, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FFBF3C30000) + 0x526A1 byte(s), RtlUserThreadStart() + 0x21 byte(s)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWltvo0wS_TXkpRUEzf3BD9ysHW1mJhrPN6PdF6uh2zYTDAiaJM6v3yrwLdib2F5b2pU2ihxoqk-drq5bByclX40ikbTzeVbMCSMLkefl_UtZ55z8M4ORqsqzlMmsLAhRqKvY2hsMZ0Um78WrgFuFhp3ks6gblNJUXVO1ey6eVZPqhkIDT080i3HTUahH2gYV5TlPtjN0S4VJBK5-ZwUvXxrCS9GQopQEiDypihYpmt9_TlbLpMwbwmrRCVRZ-iQ4aSvCWlkugWjK8ny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