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

2020-10-11 Thread Bernhard Übelacker
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 "" 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=, base=, ctx=) at 
winedbg.c:429
429 if (!strcmp(mod_name, ""))
1: x/i $pc
=> 0x7fa056f4 :   mov$0xe,%ecx
(rr) bt
#0  mod_loader_cb (mod_name=, base=, ctx=) 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=, 
EnumModulesCallback=, UserContext=) at 
module.c:838
#3  0x7f97ab66 in SymEnumerateModules64 (hProcess=0x2c, 
EnumModulesCallback=0x7fa056d0 , UserContext=0x32f294) at 
module.c:817
#4  0x7fa06284 in dbg_get_debuggee_info (hProcess=, imh_mod=) 
at winedbg.c:452
#5  0x7f9f5724 in gdb_remote (flags=, port=) at 
gdbproxy.c:1930
#6  0x7f9f7cc3 in gdb_main (argc=, argv=) 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=) 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=, peb=) at 
process.c:153
#11 0x7b45488e in __wine_start_process () from 
/usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#12 0x 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 PPIDEXITCMD
7243--  0   wine winedbg --gdb notepad.exe
724572430   /usr/lib/wine/wineserver
72467245-9  (forked without exec)
724772430   (forked without exec)
724872470   /usr/lib/wine/wine C:\windows\system32\wineboot.exe 
--init
724972480   (forked without exec)
725072490   /usr/lib/wine/wine 
C:\windows\system32\winemenubuilder.exe -a -r
725172480   (forked without exec)
72527251-9  /usr/lib/wine/wine C:\windows\system32\services.exe
725472520   (forked without exec)
72557254-9  /usr/lib/wine/wine C:\windows\system32\plugplay.exe
725672500   (forked without exec)
725772560   /usr/lib/wine/wine C:\windows\system32\explorer.exe 
/desktop
726372520   (forked without exec)
72647263-9  /usr/lib/wine/wine C:\windows\system32\winedevice.exe
727572520   (forked without exec)
72767275-9  /usr/lib/wine/wine C:\windows\system32\winedevice.exe
728272430   (forked without exec)
72837282-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.
0x700e in ?? ()
1: x/i $pc
=> 0x700e:  ret
(rr) bt
#0  0x700e in ?? ()
#1  0xb7f06ef1 in _raw_syscall () at 

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

2020-10-11 Thread Bill Blough
Hi Bernhard,

Thanks very much for investigating this!

I can confirm that adjusting the PATH works around the issue for me.

Best regards,
Bill



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

2020-09-26 Thread William Blough
Package: wine
Version: 5.0-4
Severity: normal

Hi,

Trying to use the --gdb flag with winedbg does not work with 32-bit
WINEPREFIXes. Instead of spawning gdb, it just exits:

user@host:~$ WINEPREFIX=~/.wine32 winedbg --gdb notepad.exe
002a:002b: create process 'C:\windows\system32\notepad.exe' /0x1106b0 
@0x7fa07e50 (0<0>)
002a:002b: create thread I @0x7fa07e50
user@host:~$

Running the same command with a 64-bit prefix works as expected:

user@host:~$ winedbg --gdb notepad.exe
002b:002c: create process 'C:\windows\system32\notepad.exe'/0x10980 
@0x7f8993d81b60 (0<0>)
002b:002c: create thread I @0x7f8993d81b60
GNU gdb (Debian 8.2.1-2+b3) 8.2.1



002b:002c: loads DLL C:\windows\system32\uxtheme.dll @0x7f899094 (0<0>)
warning: remote target does not support file transfer, attempting to access 
files from local filesystem.
0x7bc961e5 in DbgBreakPoint () from 
/usr/lib/wine/../x86_64-linux-gnu/wine/ntdll.dll.so
Wine-gdb>



I was able to reproduce the issue on a VM running only bullseye i386 (no
foreign architectures), so it doesn't appear to be a multi-arch related issue.

Also, the upstream packages work as expected on bullseye i386. I
haven't tested them on buster.


Tested, not working:
---

Buster, amd64, wine 4.0-2 from buster repo, 32-bit WINEPREFIX
Bullseye, i386, wine 5.0-4 from bullseye repo, 32-bit WINEPREFIX


Tested, working as expected:
---

Buster, amd64, wine 4.0-2 from buster repo, 64-bit WINEPREFIX
Bullseye, i386, winehq-stable 4.0.2~bullseye from winehq repo, 32-bit WINEPREFIX
Bullseye, i386, winehq-stable 5.0.2~bullseye from winehq repo, 32-bit WINEPREFIX
Bullseye, i386, winehq-devel 5.18~bullseye from winehq repo, 32-bit WINEPREFIX


Best regards,
Bill