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

    <tr>
        <th>Summary</th>
        <td>
            Regression in LLDB reading i386/mingw PDB debug info since "[LLDB][NativePDB] Switch to use DWARFLocationList."
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lldb,
            regression,
            platform:windows
      </td>
    </tr>

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

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

<pre>
    With the attached testcase [hello-exception-pdb-i686.zip](https://github.com/llvm/llvm-project/files/9591745/hello-exception-pdb-i686.zip), an i386 executable with PDB info, it no longer prints variable locations/contents correctly since this commit (https://reviews.llvm.org/D130796, 71d778f33e8615f525f118db351c6541b40199ab). It still works correctly for x86_64 and aarch64 like it did before.

To reproduce, with the attached executable:

```
> $ lldb.exe -- hello-exception-pdb.exe -crash
(lldb) target create "c:\\code\\pdb-repro\\hello-exception-pdb.exe"
Current executable set to 'c:\code\pdb-repro\hello-exception-pdb.exe' (i386).
(lldb) settings set -- target.run-args  "-crash"..
(lldb) run
(lldb) Process 1424 launched: 'c:\code\pdb-repro\hello-exception-pdb.exe' (i386)
Process 1424 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x261453: Access violation writing location 0x00000000
    frame #0: 0x00261453 hello-exception-pdb.exe`recurse(val=0) at hello-exception.cpp:51
(lldb) bt
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x261453: Access violation writing location 0x00000000
  * frame #0: 0x00261453 hello-exception-pdb.exe`recurse(val=0) at hello-exception.cpp:51
    frame #1: 0x002615b1 hello-exception-pdb.exe`recurse(val=1) at hello-exception.cpp:68
    frame #2: 0x002615b1 hello-exception-pdb.exe`recurse(val=2) at hello-exception.cpp:68
    frame #3: 0x002615b1 hello-exception-pdb.exe`recurse(val=3) at hello-exception.cpp:68
    frame #4: 0x002615b1 hello-exception-pdb.exe`recurse(val=4) at hello-exception.cpp:68
    frame #5: 0x002614ef hello-exception-pdb.exe`recurse(val=5) at hello-exception.cpp:62
    frame #6: 0x002615b1 hello-exception-pdb.exe`recurse(val=6) at hello-exception.cpp:68
    frame #7: 0x002615b1 hello-exception-pdb.exe`recurse(val=7) at hello-exception.cpp:68
    frame #8: 0x002615b1 hello-exception-pdb.exe`recurse(val=8) at hello-exception.cpp:68
    frame #9: 0x002615b1 hello-exception-pdb.exe`recurse(val=9) at hello-exception.cpp:68
    frame #10: 0x002615b1 hello-exception-pdb.exe`recurse(val=10) at hello-exception.cpp:68
    frame #11: 0x002617ec hello-exception-pdb.exe`main(argc=2, argv=0x00284f50) at hello-exception.cpp:95
    frame #12: 0x00261393 hello-exception-pdb.exe
    frame #13: 0x74c20419 kernel32.dll`BaseThreadInitThunk + 25
    frame #14: 0x771c662d ntdll.dll`RtlGetAppContainerNamedObjectPath + 237
    frame #15: 0x771c65fd ntdll.dll`RtlGetAppContainerNamedObjectPath + 189
```

(To get proper debugging of an i386 executable, you also need to have LLDB built in i386 mode.)

Since this commit, I get this printout:
```
(lldb) target create "c:\\code\\pdb-repro\\hello-exception-pdb.exe"
(rrent executable set to 'c:\code\pdb-repro\hello-exception-pdb.exe' (i386).
(ldb) settings set -- target.run-args  "-crash".
(lldb) run
(lldb) Process 4068 launched: 'c:\code\pdb-repro\hello-exception-pdb.exe' (i386)
Process 4068 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x261453: Access violation writing location 0x00000000
    frame #0: 0x00261453 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:51
(lldb) bt
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x261453: Access violation writing location 0x00000000
  * frame #0: 0x00261453 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:51
    frame #1: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #2: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #3: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #4: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #5: 0x002614ef hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:62
    frame #6: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #7: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #8: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #9: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #10: 0x002615b1 hello-exception-pdb.exe`recurse(val=<unavailable>) at hello-exception.cpp:68
    frame #11: 0x002617ec hello-exception-pdb.exe`main(argc=<unavailable>, argv=<unavailable>) at hello-exception.cpp:95
    frame #12: 0x00261393 hello-exception-pdb.exe
    frame #13: 0x74c20419 kernel32.dll`BaseThreadInitThunk + 25
    frame #14: 0x771c662d ntdll.dll`RtlGetAppContainerNamedObjectPath + 237
    frame #15: 0x771c65fd ntdll.dll`RtlGetAppContainerNamedObjectPath + 189
```
Note, the `recurse(val=<unavailable>)` everywhere.

The strange thing is that this only regressed if LLDB was built in mingw mode; an MSVC built LLDB still correctly handles this case. (`settings set plugin.object-file.pe-coff.abi gnu` in the MSVC built case doesn't make any difference, nor does `settings set plugin.object-file.pe-coff.abi msvc` in the mingw built case either.)

CC @ZequanWu 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztmVtv2zYUxz-N_UJY0I26PPghcdqhQNYVbbECexkoirLY0KRGUnayT79DSk3cxAkm1S2GoYZg3cjzP-eQon4UK1XfrT9x2yLbMkSsJbRlNbLMWEoMQwt82TIh1IrdUtZZruSqq6sVz4os-Jt3C3y1iIvW2s4skotF_Bq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