On Wed Jun 25 12:53:03 2025 +0000, Rémi Bernon wrote:
I don't know either, I had a look but it seemed deeply rooted in lldb and its expected module format was driven by the process target, and it refuses to load anything else than ELF if the process is detected as a Linux native process.
Unfortunately I found no cheaper way, but following steps allowed me to get over the `Found local object file but the specs didn't match` message by rebuilding a local lldb with a small patch.
``` git clone https://github.com/llvm/llvm-project.git cd llvm-project # git as of 52b27c2b # apply the patch below mkdir build_optdebug && cd build_optdebug CC=/usr/bin/clang-19 CXX=/usr/bin/clang++-19 cmake -GNinja -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=RelWithDebInfo ../llvm ninja -j10 lldb lldb-server ``` ```diff diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 70b9800f4dad..37016f1e4ce7 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -1014,6 +1014,7 @@ bool ArchSpec::IsMatch(const ArchSpec &rhs, MatchType match) const { // On Windows, the vendor field doesn't have any practical effect, but // it is often set to either "pc" or "w64". if ((lhs_triple_vendor != rhs_triple_vendor) && + (lhs_triple_vendor != llvm::Triple::PC && rhs_triple_vendor != llvm::Triple::UnknownVendor) && (match == ExactMatch || !both_windows)) { const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified(); const bool lhs_vendor_specified = TripleVendorWasSpecified(); @@ -1034,6 +1035,12 @@ bool ArchSpec::IsMatch(const ArchSpec &rhs, MatchType match) const { rhs_triple.getEnvironment();
if (match == CompatibleMatch) { + // wine-preloader, x86_64-unknown-linux-gnu, loads Windows dlls x86_64-pc-windows-msvc + if ((lhs_triple_os == llvm::Triple::Win32 && + lhs_triple_env == llvm::Triple::MSVC && + rhs_triple_os == llvm::Triple::Linux && + rhs_triple_env == llvm::Triple::GNU)) + return true; // x86_64-apple-ios-macabi, x86_64-apple-macosx are compatible, no match. if ((lhs_triple_os == llvm::Triple::IOS && lhs_triple_env == llvm::Triple::MacABI && ``` ``` $ /full/path/to/llvm-project/build_optdebug/bin/lldb (lldb) log enable lldb module dyld (lldb) process attach --pid 3848257 (lldb) process handle --pass true --stop false --notify false SIGUSR1 ... (lldb) bt * thread #1, name = 'notepad.exe', stop reason = breakpoint 1.1 * frame #0: 0x00006ffffd384c66 user32.dll`WINPROC_wrapper(proc=(comctl32.dll`COMCTL32_SubclassProc at commctrl.c:1228), hwnd=0x0000000000010086, msg=256, wParam=144, lParam=21299201) at winproc.c:86:12 frame #1: 0x00006ffffd38389d user32.dll`call_window_proc(hwnd=<unavailable>, msg=256, wp=<unavailable>, lp=21299201, result=0x00007ffffe1ffb68, arg=0x00006ffffdbcd680) at winproc.c:111:15 frame #2: 0x00006ffffd3839ff user32.dll`dispatch_win_proc_params(params=0x00007ffffe1ffbc8) at winproc.c:0 frame #3: 0x00006ffffd36ff4e user32.dll`dispatch_message(msg=0x00007ffffe1ffcc0, ansi=<unavailable>) at message.c:805:14 frame #4: 0x00006ffffd37000a user32.dll`DispatchMessageW(msg=0x00007ffffe1ffcc0) at message.c:891:16 frame #5: 0x0000000140009817 notepad.exe`WinMain(hInstance=0x0000000140000000, prev=<unavailable>, cmdline=<unavailable>, show=<unavailable>) at main.c:852:13 ```
It allows also me to add symbol information from PDB files to a mshtml_test.exe process: ``` (lldb) target symbols add .../drive_c/windows/system32/gecko/2.47.4/wine_gecko/xul.dll' ```