Trouble using winedbg even with the simplest exe

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Post Reply
mikro
Newbie
Newbie
Posts: 2
Joined: Mon Apr 15, 2024 6:37 am

Trouble using winedbg even with the simplest exe

Post by mikro »

Hi,

I hope this is the right place to ask. I'm getting quite desperate of how to use wine's native debugger, winedbg. I'm trying to debug a proprietary application's bug (which demonstrates itself only in wine) but I couldn't get anything working. Soon I have realised that my problem is of a bigger scale as I can't debug basically *any* application, even the simplest Hello World (attached).

So what happens. If I run the exe (or my proprietary application) in plain 'wine', all good. However if I keep everything intact and just change 'wine' for 'winedbg', I'm unable to run it at all:

Code: Select all

$WINEPREFIX=~/wine_prefix wine ./ConsoleApplication1.exe
wine: created the configuration directory '/home/bisimuser/wine_prefix'
0050:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0050:err:ole:apartment_get_local_server_stream Failed: 0x80004002
0048:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0048:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0048:err:ole:apartment_get_local_server_stream Failed: 0x80004002
0048:err:ole:start_rpcss Failed to open RpcSs service
0040:err:setupapi:SetupDefaultQueueCallbackW copy error 1812 L"@wineusb.sys,-1" -> L"C:\\windows\\inf\\wineusb.inf"
Could not find Wine Gecko. HTML rendering will be disabled.
Could not find Wine Gecko. HTML rendering will be disabled.
wine: configuration in L"/home/bisimuser/wine_prefix" has been updated.
Hello World!
$ WINEPREFIX=~/wine_prefix winedbg ./ConsoleApplication1.exe
WineDbg starting on pid 00d0
0x000000007bc52e89 EntryPoint+0xffffffffffffffff in ntdll: ret
Wine-dbg>c
Process of pid=00d0 has terminated
Wine-dbg>
This is a log of a first-time run. 'wine' prints "Hello World!" as expected. However 'winedbg' opens an additional window (with black background and nothing printed) while getting stuck in the debugger. If I press 'c', I get only the process terminated message.

This is wine 6.0.3 from Ubuntu 22.04 LTS, clean install from scratch. I have also tried installing wine 9.x - same outcome. I've been digging through development documentation for quite some time now and I can't see anything pointing to a fact that additional setup is needed so I must be overlooking something trivial.

The application is compiled against VS2022 runtime, Windows SDK 10.0.19041.0 if it matters (but I guess not otherwise 'wine' wouldn't be able to execute it, right?)

Interestingly, if I try something built-in, like 'winedbg notepad.exe', I get it running without any problem.

Any help appreciated.
Attachments
release-x86.zip
(139.39 KiB) Downloaded 244 times
mikro
Newbie
Newbie
Posts: 2
Joined: Mon Apr 15, 2024 6:37 am

Re: Trouble using winedbg even with the simplest exe

Post by mikro »

Hey guys,

I see 132 people have downloaded the zip archive. All I'm looking for here is at least a sign whether it works for you (and I'm doing something stupid and/or my distro's winegdb is somehow faulty) or whether you get the same behaviour (i.e. the opened window, no "Hello World!" message etc).
XP100
Newbie
Newbie
Posts: 2
Joined: Mon Apr 29, 2024 2:48 pm

Re: Trouble using winedbg even with the simplest exe

Post by XP100 »

Just tried your EXE. You need to set a breakpoint first. Otherwise, nothing will happen.

Find the function you want to break. Run "env WINEDEBUG=+relay wine ConsoleApplication1.exe 2> relay.log". This generates a 150 MB log file. Search for "WriteConsoleW".

In winedbg, type:
"b WriteConsoleW" or "break WriteConsoleW"

Next, type "c" or "cont". You see the first "H" of "Hello" being printed.
Press enter to continue again.
The "e" is printed.
Press enter to continue again.
The "l" is printed.
...
Post Reply