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

    <tr>
        <th>Summary</th>
        <td>
            LLDB (native PDB plugin) hangs trying to print variables from MSVC generated i386 binaries
        </td>
    </tr>

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

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

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

<pre>
    With the attached test binary,
[hello-exception-pdb-i686-msvc.zip](https://github.com/llvm/llvm-project/files/9595303/hello-exception-pdb-i686-msvc.zip), which is built for x86 targets with MSVC, the LLDB native PDB code seems to fail to handle variable locations in x86 code built with MSVC (while it works for clang generated debug info, or at least worked before the regression in #57799). This didn't work before the issue in #57799 either.

With the attached example binary, running it like this with the default (MS DIA SDK based) PDB plugin:
```console
> lldb.exe -- hello-exception.exe -crash
(lldb) target create "hello-exception.exe"
(lldb) Current executable set to 'C:\code\repro\hello-exception.exe' (i386).
(lldb) settings set -- target.run-args  "-crash"
(lldb) run
(lldb) Process 4908 launched: 'C:\code\repro\hello-exception.exe' (i386)
Process 4908 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x128a490: Access violation writing location 0x00000000
    frame #0: 0x0128a490 hello-exception.exe`void __cdecl recurse(val=0) at hello-exception.cpp:51
   48       RecurseClass obj(val);
   49       if (val == 0) {
   50           if (crash)
-> 51               *(volatile int*)NULL = 0x42;
   52   #ifdef _WIN32
   53           else if (breakpoint)
   54               __debugbreak();
(lldb) print val
(int) $0 = 0
(lldb)
```
Note how the frame shows `recurse(val=0)`, and `print val` successfully prints the variable.

When run with the native PDB plugin, the parameter value is missing from the frame, and trying to print the variable hangs lldb (seemingly stuck in an infinite loop?):
```console
> lldb.exe -- hello-exception.exe -crash
(lldb) target create "hello-exception.exe"
(lldb) Current executable set to 'C:\code\repro\hello-exception.exe' (i386).
(lldb) settings set -- target.run-args  "-crash"
(lldb) run
(lldb) Process 5860 launched: 'C:\code\repro\hello-exception.exe' (i386)
Process 5860 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x128a490: Access violation writing location 0x00000000
    frame #0: 0x0128a490 hello-exception.exe`recurse at hello-exception.cpp:51
   48       RecurseClass obj(val);
   49       if (val == 0) {
   50           if (crash)
-> 51               *(volatile int*)NULL = 0x42;
   52   #ifdef _WIN32
   53           else if (breakpoint)
   54               __debugbreak();
(lldb) print val
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztV9lu4zYU_Rr7hbChxbKlBz9k4hlg0EwwaNrOY0BJVxYntCiQlJP063supcTOAhRFWxQohjAsibzLuQsPpdLUj9tvyrfCtySk97JqqRaenBel6qR9nCWXs2g3iy5m2YeWtDYLeqio98p0i74uF2qdrxcHd6yWv6t-lu1mSd5637tZejFLPuG3h_WhXFbmgAetj0-XRW_Nd6o8HhulyeFaZEWWRinu_txTUgCZuG9V1QrlRDko7UVjrHjI18JLuyfvxD1H9uXmt0uW5QivrnYfRCe9OpL4itvK1CQc0cEJb0QjleZrK7takzhKq2SJG20qyTCcUF2wH9RGl88uBCIHHIgrzBp75wKcSstuL_bUkZUeqa2pHPaw0xjGBAHphSbpRh0IlAQ1Cmgt7S05B8_seJak2WZTIO5iKX5pEXSt6m6WbEbVc0Xl3EDnOoIAk-xyKmX4f1t2epCHHgE8V17YoesU8CMkre7YuJqyyoo1NXJADhD5lxux-3whbnY_iVI6qgEyJLjXw1513Ayj53U0_ipk02iaZtOPQuu6XNIDicVCvKr-OF1Z6dpJPslZnH2MlRaVJWQXQJJ3dDH7Ru9ysJY6j5CpGnyosoMdFB8JvWS82SVXGRdL6FRc37W84eBVmq-5Km-8wKRH-lywjcBGtEtkdYE7JxjwFNg7GCH2Zu6rNRVaQqyKKBdaDh0XDnD_BuzRxwvDzpu-h93J-wWqjQTX3E4xtwWvozulQ2fO0p34-GRdR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