[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#971054: winedbg --gdb does not work with 32-bit WINEPREFIX



Dear Maintainer,
tried to have a look at it and found that this might be caused by
the wine binary being pointed to by Debians alternatives system.

Therefore winedbg does not find the loader shared object of the target
process and cannot map it (elf_read_wine_loader_dbg_info).
That module would be marked as "<wine-loader>" and 'winedbg --gdb'
relies on finding that in function mod_loader_cb.
If it cannot be found windbg exits directly after dbg_get_debuggee_info [1],
unfortunately without any message.

This can be worked around by setting the path before like in [2].

Because upstream changed winedbg since 5.6 to not rely on knowing the loader,
I guess a "debianized" wine package from that version upwards should also
not show this issue. [3]

Kind regards,
Bernhard


[1]
Breakpoint 7, mod_loader_cb (mod_name=<optimized out>, base=<error reading variable: Could not find the frame base for "mod_loader_cb".>, ctx=<error reading variable: Could not find the frame base for "mod_loader_cb".>) at winedbg.c:429
429         if (!strcmp(mod_name, "<wine-loader>"))
1: x/i $pc
=> 0x7fa056f4 <mod_loader_cb+36>:       mov    $0xe,%ecx
(rr) bt
#0  mod_loader_cb (mod_name=<optimized out>, base=<error reading variable: Could not find the frame base for "mod_loader_cb".>, ctx=<error reading variable: Could not find the frame base for "mod_loader_cb".>) at winedbg.c:429
#1  0x7f978bc5 in enum_modW64_64 (name=0x139ef8, base=2141257728, user=0x32f140) at module.c:805
#2  0x7f97aa79 in SymEnumerateModulesW64 (hProcess=<optimized out>, EnumModulesCallback=<optimized out>, UserContext=<optimized out>) at module.c:838
#3  0x7f97ab66 in SymEnumerateModules64 (hProcess=0x2c, EnumModulesCallback=0x7fa056d0 <mod_loader_cb>, UserContext=0x32f294) at module.c:817
#4  0x7fa06284 in dbg_get_debuggee_info (hProcess=<error reading variable: Could not find the frame base for "dbg_get_debuggee_info".>, imh_mod=<error reading variable: Could not find the frame base for "dbg_get_debuggee_info".>) at winedbg.c:452
#5  0x7f9f5724 in gdb_remote (flags=<optimized out>, port=<optimized out>) at gdbproxy.c:1930
#6  0x7f9f7cc3 in gdb_main (argc=<optimized out>, argv=<optimized out>) at gdbproxy.c:2110
#7  0x7f9e75e1 in main () from /usr/lib/wine/../i386-linux-gnu/wine/winedbg.exe.so
#8  0x7fa0c8cd in __wine_spec_exe_entry (peb=<optimized out>) at exe_entry.c:64
#9  0x7b454882 in call_process_entry () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#10 0x7b454cfc in start_process (entry=<optimized out>, peb=<optimized out>) at process.c:153
#11 0x7b45488e in __wine_start_process () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#12 0x00000000 in ?? ()


[2]
export PATH=/usr/lib/wine:$PATH
wine winedbg --gdb notepad


[3]
https://source.winehq.org/git/wine.git/patch/86ed5e563dc75bc5dae30f9647eefa63efb132d5
# Bullseye/testing i386 qemu VM 2020-10-11


apt update
apt dist-upgrade


apt install systemd-coredump mc htop fakeroot quilt lightdm xserver-xorg openbox xterm sshfs libcapnp-dev gdb wine wine32-dbgsym libwine-dbgsym
apt build-dep wine

reboot


echo 1 > /proc/sys/kernel/perf_event_paranoid
# prebuilt rr:
mkdir -p /home/bernhard/data/entwicklung/2020/rr/2020-10-09
sshfs -o allow_other,uid=1000,gid=1000 bernhard@192.168.178.25:/home/bernhard/data/entwicklung/2020/rr/2020-10-09 /home/bernhard/data/entwicklung/2020/rr/2020-10-09




mkdir /home/benutzer/source/wine/orig -p
cd    /home/benutzer/source/wine/orig
apt source wine
cd



export DISPLAY=:0
export WINEPREFIX=~/.wine32
wine wineboot

wine winedbg --gdb notepad.exe







$ WINEDEBUG=+process /home/bernhard/data/entwicklung/2020/rr/2020-10-09/obj_i686/bin/rr wine winedbg --gdb notepad.exe
rr: Saving execution to trace directory `/home/benutzer/.local/share/rr/wine-4'.
...


benutzer@debian:~$ /home/bernhard/data/entwicklung/2020/rr/2020-10-09/obj_i686/bin/rr ps /home/benutzer/.local/share/rr/wine-4
PID     PPID    EXIT    CMD
7243    --      0       wine winedbg --gdb notepad.exe
7245    7243    0       /usr/lib/wine/wineserver
7246    7245    -9      (forked without exec)
7247    7243    0       (forked without exec)
7248    7247    0       /usr/lib/wine/wine C:\windows\system32\wineboot.exe --init
7249    7248    0       (forked without exec)
7250    7249    0       /usr/lib/wine/wine C:\windows\system32\winemenubuilder.exe -a -r
7251    7248    0       (forked without exec)
7252    7251    -9      /usr/lib/wine/wine C:\windows\system32\services.exe
7254    7252    0       (forked without exec)
7255    7254    -9      /usr/lib/wine/wine C:\windows\system32\plugplay.exe
7256    7250    0       (forked without exec)
7257    7256    0       /usr/lib/wine/wine C:\windows\system32\explorer.exe /desktop
7263    7252    0       (forked without exec)
7264    7263    -9      /usr/lib/wine/wine C:\windows\system32\winedevice.exe
7275    7252    0       (forked without exec)
7276    7275    -9      /usr/lib/wine/wine C:\windows\system32\winedevice.exe
7282    7243    0       (forked without exec)
7283    7282    -9      /usr/lib/wine/wine notepad.exe


benutzer@debian:~$ /home/bernhard/data/entwicklung/2020/rr/2020-10-09/obj_i686/bin/rr wine winedbg --gdb notepad.exe
rr: Saving execution to trace directory `/home/benutzer/.local/share/rr/wine-0'.
002c:002d: create process 'C:\windows\system32\notepad.exe'/0x1106b0 @0x7fa19e50 (0<0>)
002c:002d: create thread I @0x7fa19e50
benutzer@debian:~$

002c:002d: create thread I @0x7fa19e50

Program received signal SIGKILL, Killed.
0x7000000e in ?? ()
1: x/i $pc
=> 0x7000000e:  ret    
(rr) bt
#0  0x7000000e in ?? ()
#1  0xb7f06ef1 in _raw_syscall () at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/raw_syscall.S:34
#2  0xb7f05782 in untraced_syscall_base (syscall_instruction=0x7000000c, a5=0, a4=0, a3=0, a2=16, a1=-1214054330, a0=6, syscallno=3)
    at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscallbuf.c:359
#3  sys_read (call=0x681fffd8) at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscallbuf.c:2280
#4  syscall_hook_internal (call=0x681fffd8) at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscallbuf.c:3223
#5  syscall_hook (call=<optimized out>) at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscallbuf.c:3329
#6  0xb7f02324 in _syscall_hook_trampoline () at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscall_hook.S:139
#7  0xb7f022ca in _switch_stack_vsyscall () at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscall_hook.S:72
#8  0xb7f02286 in __morestack () at /home/bernhard/data/entwicklung/2020/rr/2020-10-09/rr/src/preload/syscall_hook.S:42
#9  0xb7d340a3 in __libc_read (fd=6, buf=0x32e538, nbytes=16) at ../sysdeps/unix/sysv/linux/read.c:26
#10 0x7bcacf35 in wait_select_reply (cookie=0x32e63c) at server.c:359
#11 0x7bcade6f in server_select (select_op=0x0, size=0, flags=2, timeout=0x32ecb0) at server.c:626
#12 0x7bc674f1 in wait_suspend (context=0x32ecfc) at exception.c:131
#13 0x7bcb3d93 in attach_thread (entry=0x7fa19e50 <__wine_spec_exe_entry>, arg=0xffff000, suspend=1, relay=0x7b454884 <__wine_start_process>) at signal_i386.c:2736
#14 0x7bcb3b00 in start_thread () at signal_i386.c:2595
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(rr) info thread
  Id   Target Id                      Frame 
* 1    Thread 7283.7283 (notepad.exe) 0x7000000e in ?? ()
(rr) when
Current event: 171622

-> The debugged process ...



benutzer@debian:~$ /home/bernhard/data/entwicklung/2020/rr/2020-10-09/obj_i686/bin/rr replay -p 7243 --goto=171622 /home/benutzer/.local/share/rr/wine-4
benutzer@debian:~$

benutzer@debian:~$ /home/bernhard/data/entwicklung/2020/rr/2020-10-09/obj_i686/bin/rr replay -p 7243 --goto=161622 /home/benutzer/.local/share/rr/wine-4 




(rr) bt
#0  dbg_active_attach (argc=1, argv=0x111200) at tgt_active.c:797
#1  0x7f9f7c9d in gdb_main (argc=<optimized out>, argv=<optimized out>) at gdbproxy.c:2108
#2  0x7f9e75e1 in main () from /usr/lib/wine/../i386-linux-gnu/wine/winedbg.exe.so
#3  0x7fa0c8cd in __wine_spec_exe_entry (peb=<optimized out>) at exe_entry.c:64
#4  0x7b454882 in call_process_entry () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#5  0x7b454cfc in start_process (entry=<optimized out>, peb=<optimized out>) at process.c:153
#6  0x7b45488e in __wine_start_process () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#7  0x00000000 in ?? ()
(rr) when
Current event: 163171









(rr) bt
#0  0x7f979382 in get_wine_loader_name (pcs=0x1112f8) at module.c:161
#1  0x7f97573e in elf_search_loader (pcs=<optimized out>, elf_info=<optimized out>) at elf_module.c:1765
#2  0x7f975a86 in elf_read_wine_loader_dbg_info (pcs=<error reading variable: Could not find the frame base for "elf_read_wine_loader_dbg_info".>) at elf_module.c:1807
#3  0x7f964fbb in SymInitializeW (hProcess=<optimized out>, UserSearchPath=<optimized out>, fInvadeProcess=<optimized out>) at dbghelp.c:266
#4  0x7f96522d in SymInitialize (hProcess=<optimized out>, UserSearchPath=<optimized out>, fInvadeProcess=<optimized out>) at dbghelp.c:401
#5  0x7fa060f9 in dbg_init (hProc=<error reading variable: Could not find the frame base for "dbg_init".>, in=<error reading variable: Could not find the frame base for "dbg_init".>, invade=<error reading variable: Could not find the frame base for "dbg_init".>) at winedbg.c:390
#6  0x7f9f5025 in handle_debug_event (gdbctx=<optimized out>, de=<optimized out>) at gdbproxy.c:400
#7  0x7f9f570c in gdb_remote (flags=<optimized out>, port=<optimized out>) at gdbproxy.c:1927
#8  0x7f9f7cc3 in gdb_main (argc=<optimized out>, argv=<optimized out>) at gdbproxy.c:2110
#9  0x7f9e75e1 in main () from /usr/lib/wine/../i386-linux-gnu/wine/winedbg.exe.so
#10 0x7fa0c8cd in __wine_spec_exe_entry (peb=<optimized out>) at exe_entry.c:64
#11 0x7b454882 in call_process_entry () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#12 0x7b454cfc in start_process (entry=<optimized out>, peb=<optimized out>) at process.c:153
#13 0x7b45488e in __wine_start_process () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#14 0x00000000 in ?? ()
(rr) when
Current event: 166648
(rr) x/20c buffer
0x1104d0:       119 'w' 0 '\000'        105 'i' 0 '\000'        110 'n' 0 '\000'        101 'e' 0 '\000'
0x1104d8:       0 '\000'        0 '\000'     ...

--> WINELOADER is not set, get_wine_loader_name returns "wine"







(rr) bt
#0  elf_search_and_load_file (pcs=<optimized out>, filename=<optimized out>, load_offset=<optimized out>, dyn_addr=<error reading variable: Could not find the frame base for "elf_search_and_load_file".>, elf_info=<error reading variable: Could not find the frame base for "elf_search_and_load_file".>) at elf_module.c:1646
#1  0x7f9757a7 in elf_search_loader (pcs=<optimized out>, elf_info=<optimized out>) at elf_module.c:1792
#2  0x7f975a86 in elf_read_wine_loader_dbg_info (pcs=<error reading variable: Could not find the frame base for "elf_read_wine_loader_dbg_info".>) at elf_module.c:1807
#3  0x7f964fbb in SymInitializeW (hProcess=<optimized out>, UserSearchPath=<optimized out>, fInvadeProcess=<optimized out>) at dbghelp.c:266
#4  0x7f96522d in SymInitialize (hProcess=<optimized out>, UserSearchPath=<optimized out>, fInvadeProcess=<optimized out>) at dbghelp.c:401
#5  0x7fa060f9 in dbg_init (hProc=<error reading variable: Could not find the frame base for "dbg_init".>, in=<error reading variable: Could not find the frame base for "dbg_init".>, invade=<error reading variable: Could not find the frame base for "dbg_init".>) at winedbg.c:390
#6  0x7f9f5025 in handle_debug_event (gdbctx=<optimized out>, de=<optimized out>) at gdbproxy.c:400
#7  0x7f9f570c in gdb_remote (flags=<optimized out>, port=<optimized out>) at gdbproxy.c:1927
#8  0x7f9f7cc3 in gdb_main (argc=<optimized out>, argv=<optimized out>) at gdbproxy.c:2110
#9  0x7f9e75e1 in main () from /usr/lib/wine/../i386-linux-gnu/wine/winedbg.exe.so
#10 0x7fa0c8cd in __wine_spec_exe_entry (peb=<optimized out>) at exe_entry.c:64
#11 0x7b454882 in call_process_entry () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#12 0x7b454cfc in start_process (entry=<optimized out>, peb=<optimized out>) at process.c:153
#13 0x7b45488e in __wine_start_process () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#14 0x00000000 in ?? ()
(rr) when
Current event: 166713







(rr) next
455         return imh_mod->BaseOfImage != 0;
1: x/i $pc
=> 0x7fa06292 <dbg_get_debuggee_info+114>:      mov    0x8(%ebx),%eax
(rr) bt
#0  dbg_get_debuggee_info (hProcess=<error reading variable: Could not find the frame base for "dbg_get_debuggee_info".>, imh_mod=<error reading variable: Could not find the frame base for "dbg_get_debuggee_info".>) at winedbg.c:455
#1  0x7f9f5724 in gdb_remote (flags=<optimized out>, port=<optimized out>) at gdbproxy.c:1930
#2  0x7f9f7cc3 in gdb_main (argc=<optimized out>, argv=<optimized out>) at gdbproxy.c:2110
#3  0x7f9e75e1 in main () from /usr/lib/wine/../i386-linux-gnu/wine/winedbg.exe.so
#4  0x7fa0c8cd in __wine_spec_exe_entry (peb=<optimized out>) at exe_entry.c:64
#5  0x7b454882 in call_process_entry () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#6  0x7b454cfc in start_process (entry=<optimized out>, peb=<optimized out>) at process.c:153
#7  0x7b45488e in __wine_start_process () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#8  0x00000000 in ?? ()
(rr) when
Current event: 171550
(rr) disassemble
Dump of assembler code for function dbg_get_debuggee_info:
   0x7fa06220 <+0>:     push   %ebp
...
   0x7fa06265 <+69>:    mov    %edi,-0x24(%ebp)
   0x7fa06268 <+72>:    mov    %ebx,-0x20(%ebp)
   0x7fa0626b <+75>:    call   0x7f9e78a8 <SymSetExtendedOption>
   0x7fa06270 <+80>:    sub    $0xc,%esp
   0x7fa06273 <+83>:    mov    %eax,%esi
   0x7fa06275 <+85>:    lea    -0x24(%ebp),%eax
   0x7fa06278 <+88>:    push   %eax
   0x7fa06279 <+89>:    push   $0x7fa056d0
   0x7fa0627e <+94>:    push   %edi
   0x7fa0627f <+95>:    call   0x7f9e7818 <SymEnumerateModules64>
   0x7fa06284 <+100>:   add    $0xc,%esp
   0x7fa06287 <+103>:   push   %esi
   0x7fa06288 <+104>:   push   $0x3e8
   0x7fa0628d <+109>:   call   0x7f9e78a8 <SymSetExtendedOption>
   0x7fa06292 <+114>:   mov    0x8(%ebx),%eax
=> 0x7fa06295 <+117>:   or     0xc(%ebx),%eax
   0x7fa06298 <+120>:   pop    %edx
   0x7fa06299 <+121>:   setne  %al
   0x7fa0629c <+124>:   pop    %ecx
   0x7fa0629d <+125>:   mov    -0x1c(%ebp),%edx
   0x7fa062a0 <+128>:   xor    %gs:0x14,%edx
   0x7fa062a7 <+135>:   jne    0x7fa062b4 <dbg_get_debuggee_info+148>
   0x7fa062a9 <+137>:   lea    -0xc(%ebp),%esp
   0x7fa062ac <+140>:   movzbl %al,%eax
   0x7fa062af <+143>:   pop    %ebx
   0x7fa062b0 <+144>:   pop    %esi
   0x7fa062b1 <+145>:   pop    %edi
   0x7fa062b2 <+146>:   pop    %ebp
   0x7fa062b3 <+147>:   ret    
   0x7fa062b4 <+148>:   call   0xb7c9da90 <__stack_chk_fail>
End of assembler dump.
(rr) ptype /o imh_mod
type = struct _IMAGEHLP_MODULE64 {
/*    0      |     4 */    DWORD SizeOfStruct;
/* XXX  4-byte hole  */
/*    8      |     8 */    DWORD64 BaseOfImage;
/*   16      |     4 */    DWORD ImageSize;
...
(rr) print/x $ebx
$14 = 0x32f690
(rr) print imh_mod->BaseOfImage
Could not find the frame base for "dbg_get_debuggee_info".
(rr) print ((struct _IMAGEHLP_MODULE64*)0x32f690)->BaseOfImage
$16 = 0





Breakpoint 7, mod_loader_cb (mod_name=<optimized out>, base=<error reading variable: Could not find the frame base for "mod_loader_cb".>, ctx=<error reading variable: Could not find the frame base for "mod_loader_cb".>) at winedbg.c:429
429         if (!strcmp(mod_name, "<wine-loader>"))
1: x/i $pc
=> 0x7fa056f4 <mod_loader_cb+36>:       mov    $0xe,%ecx
(rr) bt
#0  mod_loader_cb (mod_name=<optimized out>, base=<error reading variable: Could not find the frame base for "mod_loader_cb".>, ctx=<error reading variable: Could not find the frame base for "mod_loader_cb".>) at winedbg.c:429
#1  0x7f978bc5 in enum_modW64_64 (name=0x139ef8, base=2141257728, user=0x32f140) at module.c:805
#2  0x7f97aa79 in SymEnumerateModulesW64 (hProcess=<optimized out>, EnumModulesCallback=<optimized out>, UserContext=<optimized out>) at module.c:838
#3  0x7f97ab66 in SymEnumerateModules64 (hProcess=0x2c, EnumModulesCallback=0x7fa056d0 <mod_loader_cb>, UserContext=0x32f294) at module.c:817
#4  0x7fa06284 in dbg_get_debuggee_info (hProcess=<error reading variable: Could not find the frame base for "dbg_get_debuggee_info".>, imh_mod=<error reading variable: Could not find the frame base for "dbg_get_debuggee_info".>) at winedbg.c:452
#5  0x7f9f5724 in gdb_remote (flags=<optimized out>, port=<optimized out>) at gdbproxy.c:1930
#6  0x7f9f7cc3 in gdb_main (argc=<optimized out>, argv=<optimized out>) at gdbproxy.c:2110
#7  0x7f9e75e1 in main () from /usr/lib/wine/../i386-linux-gnu/wine/winedbg.exe.so
#8  0x7fa0c8cd in __wine_spec_exe_entry (peb=<optimized out>) at exe_entry.c:64
#9  0x7b454882 in call_process_entry () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#10 0x7b454cfc in start_process (entry=<optimized out>, peb=<optimized out>) at process.c:153
#11 0x7b45488e in __wine_start_process () from /usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#12 0x00000000 in ?? ()
(rr) when
Current event: 171550














https://source.winehq.org/git/wine.git/commit/86ed5e563dc75bc5dae30f9647eefa63efb132d5?f=programs/winedbg/gdbproxy.c

https://source.winehq.org/git/wine.git/history/HEAD:/programs/winedbg/gdbproxy.c

Reply to: