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

    <tr>
        <th>Summary</th>
        <td>
            LLDB (Windows): stopping thread while debugging i686-w64-windows-gnu targets always stops at Wow64PrepareForException
        </td>
    </tr>

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

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

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

<pre>
    Running lldb 15.0.1, Windows x64

When debugging `i686-w64-windows-gnu` targets (w/ dwarf2 exception), regardless of location where a thread is stopped for some reason, it always stops at `wow64.dll`Wow64PrepareForException`.

Here's an example of segfault:
```
Process 360232 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x000023: User-mode data execution prevention (DEP) violation at location 0x00000023
    frame #0: 0x7ffe7555b530 wow64.dll`Wow64PrepareForException + 6480
wow64.dll`Wow64PrepareForException:
->  0x7ffe7555b530 <+6480>: movb   $0x1, 0x20(%esp)
    0x7ffe7555b535 <+6485>: jmp    0x7ffe7555b53c            ; <+6492>
    0x7ffe7555b537 <+6487>: decl   %eax
    0x7ffe7555b538 <+6488>: movl   0x50(%esp), %ebx
```

Here's an example of reaching breakpoint:
```
Process 279784 stopped
* thread #1, stop reason = Exception 0x4000001f encountered at address 0xda0774
    frame #0: 0x7ffe7555b530 wow64.dll`Wow64PrepareForException + 6480
wow64.dll`Wow64PrepareForException:
->  0x7ffe7555b530 <+6480>: movb   $0x1, 0x20(%esp)
    0x7ffe7555b535 <+6485>: jmp    0x7ffe7555b53c            ; <+6492>
    0x7ffe7555b537 <+6487>: decl   %eax
    0x7ffe7555b538 <+6488>: movl   0x50(%esp), %ebx
```

At this point you cannot backtrace or inspect the context as the original frame is no more, so it's mostly useless minus the exception description. Expected behavior is that the thread is properly stopped at the location in question, like segfault locations or breakpoints, with the frame intact.
</pre>
<img width="1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