Issue 131319
Summary [LLDB] Doesn't run correctly in Wine
Labels lldb, regression:16
Assignees
Reporter mstorsjo
    This is a regression since fe17e026959cc263c12fafa3a8e9e83503f9a18b (included since LLVM 16) - before this commit, LLDB worked in Wine.

To reproduce - on Ubuntu 24.04 on x86_64, install the distro-provided Wine (9.0), download and unpack https://github.com/mstorsjo/llvm-mingw/releases/download/20220906/llvm-mingw-20220906-ucrt-x86_64.zip (LLVM 15) and https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-x86_64.zip (LLVM 16). (The same issue also reproduces with the latest Wine from git as of today, 10.3.)

As testcase, compile https://github.com/mstorsjo/llvm-mingw/blob/master/test/hello-exception.cpp with an x86_64 mingw compiler of your choice (e.g. https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz), `x86_64-w64-mingw32-g++ test/hello-exception.cpp -o hello-exception.exe -static -g`.

Run this testcase (which simulates a crash) in LLDB:
```
$ wine ~/llvm-mingw-20220906-ucrt-x86_64/bin/lldb.exe -- hello-exception.exe -crash
(lldb) target create "hello-exception.exe"
Current executable set to 'Z:\home\martin\code\llvm-mingw\hello-exception.exe' (x86_64).
(lldb) run
(lldb) Process 3916 launched: 'Z:\home\martin\code\llvm-mingw\hello-exception.exe' (x86_64)
Process 3916 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x1400013e0: Access violation writing location 0x00000000
    frame #0: 0x00000001400013e0 hello-exception.exe`recurse(val=0) at hello-exception.cpp:51:34
   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)
```
Much of this output is produced by LLDB itself; the user only needs to invoke the command, then enter `run` in the LLDB console. This requires opening a separate window, so it needs to be run with a working X display. If the testcase is built with (a modern) GCC rather than with Clang, LLDB 16 fails to parse the DWARF debug info - but that's unrelated.

After the LLDB commit that breaks it, the output is this instead:

```
$ wine ~/llvm-mingw-20230320-ucrt-x86_64/bin/lldb.exe -- hello-exception.exe -crash
(lldb) target create "hello-exception.exe"
Current executable set to 'Z:\home\martin\code\llvm-mingw\hello-exception.exe' (x86_64).
(lldb) run
Process 4288 launched: 'Z:\home\martin\code\llvm-mingw\hello-exception.exe' (x86_64)
(lldb) bt
[0;1;31merror: [0mCommand requires a process which is currently stopped.
(lldb)
```

Here, the process is started just as well as it was before, but there is no feedback that the process stopped, and if invoking `bt` to inspect the process, LLDB doesn't seem to be aware of the started process.

It is unclear whether this is an LLDB bug or a Wine bug; the regressing commit doesn't directly involve calling e.g. new Windows APIs that Wine might not implement correctly. As it was working before this commit, it's not implausible that this is an issue in LLDB.

CC @alvinhochun @cjacek @labath
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to