[Wine] Debugging a "X Error of failed request: BadAlloc"

Traumflug
Sat, 01 Oct 2011 22:32:41 -0000

Hello all,

as an almost daily user of Wine I'd finally like to get around to use my
favourite CAD application, Catia, on Wine as well. This complex application is
close, simple things can be done already. Even a small Finite Elements Analysis
got the right results.

My OS of choice is Ubuntu 11.04, AMD64. With Wine 1.2 from the package manager
one gets far, although menus are very slow. Wine 1.3 is better with the menus,
however, sometime the X sever bails out. I've found a bug which pretty much
describes what I see: http://bugs.winehq.org/show_bug.cgi?id=24921

To get to the bottom of this, I compiled Wine from git sources. However, running
this under a debugger isn't as simple as I thought. The best results so far
I get with this patch applied:

Code:
diff --git a/tools/winewrapper b/tools/winewrapper
index b324daa..1045c51 100755
--- a/tools/winewrapper
+++ b/tools/winewrapper
@@ -102,4 +102,4 @@ fi

 # and run the application

-exec "$WINELOADER" "$@"
+exec gdb --args "$WINELOADER" "$@"



This works reasonable so far. Probably I should run winedbg, but for some reason
or another, no such binary is built.

The currently bigger part of the problem is, as X bails out, the program exits
with a SIGPIPE ...

Code:
X Error of failed request:  BadValue (integer parameter out of range for
operation)
  Major opcode of failed request:  53 (X_CreatePixmap)
  Value in failed request:  0x0
  Serial number of failed request:  137886
  Current serial number in output stream:  138415

Program received signal SIGPIPE, Broken pipe.


 ... so you end up in the signal handler instead of the buggy part of the code.
Googling a lot, I tried parameters like --sync, -synchronize, ... all to no
effect.

So, my question is: how whould I catch such X errors? Ideally in a way which
survives forks, as this application uses sort of a binary wrapper application.