Debugging issues on MacOSX

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
begemott
Newbie
Newbie
Posts: 2
Joined: Thu Apr 22, 2010 8:06 am

Debugging issues on MacOSX

Post by begemott »

Hello,

I have examined different possibilities to run a Windows program on Mac and it seems to me that Wine is the best one.
Since the program I will try to run is complex I decided to test debugging capabilities of Wine.

What I did (tried)?

1. My system is: Mac Mini, Mac OS X 10.6.3.
2. I downloaded Wine 1.1.43 and built it successfully with:

Code: Select all

export CFLAGS="-arch i386 -m32"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-I/usr/X11/include"
export LDFLAGS="-L/usr/X11/lib"

./configure
make depend && make
(I didn't make install)
3. I created a very simple WTL based test application. It is a dialog with two buttons (OK, Cancel). Pressing OK purposely generates division
by zero exception. Then I copied the .exe, .cpp, .h, .pdb files in a /test directory on my Mac.

4. I ran this application by ./wine /test/WTLTest.exe > ./error.log 2>&1
Then pressed OK and the program crashed. Here is a portion from the log:

Code: Select all

wine: Unhandled division by zero at address 0x446370 (thread 0009), starting debugger...
Wine cannot find the FreeType font library.  To enable Wine to
use TrueType fonts please install a version of FreeType greater than
or equal to 2.0.5.
http://www.freetype.org
Unhandled exception: divide by zero in 32-bit code (0x00446370).
Register dump:
 CS:0017 SS:001f DS:001f ES:001f FS:1007 GS:0037
 EIP:00446370 ESP:0032f0c0 EBP:0032f1b0 EFLAGS:00010216(  R- --  I   -A-P- )
 EAX:00000020 EBX:4261c028 ECX:0032fdcc EDX:00000000
 ESI:0032f2e0 EDI:0032f1b0
Stack dump:
0x0032f0c0:  0032f2c0 0032f2e0 4261c028 cccccccc
0x0032f0d0:  cccccccc cccccccc cccccccc cccccccc
0x0032f0e0:  cccccccc cccccccc cccccccc cccccccc
0x0032f0f0:  cccccccc cccccccc cccccccc cccccccc
0x0032f100:  cccccccc cccccccc cccccccc cccccccc
0x0032f110:  cccccccc cccccccc cccccccc cccccccc
0200: sel=1007 base=7ffc0000 limit=00000fff 32-bit rw-
Backtrace:
=>0 0x00446370 in wtltest (+0x46370) (0x0032f1b0)
  1 0x0046d552 in wtltest (+0x6d551) (0x0032f2c0)
  2 0x0043c7fa in wtltest (+0x3c7f9) (0x0032f418)
  3 0x4261be2a WINPROC_wrapper+0x19() in user32 (0x0032f448)
  4 0x4261c0e1 call_dialog_proc+0xc6() in user32 (0x0032f4a8)
  5 0x4261f0f9 WINPROC_CallDlgProcW+0x166() in user32 (0x0032f4f8)
  6 0x4259250a DefDlgProcW+0xac() in user32 (0x0032f548)
  7 0x4261be2a WINPROC_wrapper+0x19() in user32 (0x0032f588)
  8 0x4261bf85 call_window_proc+0xc6() in user32 (0x0032f5d8)
  9 0x4261e9dc WINPROC_call_window+0x15d() in user32 (0x0032f628)
  10 0x425d93db call_window_proc+0xbf() in user32 (0x0032f688)
  11 0x425dbb08 send_message+0x139() in user32 (0x0032f6e8)
  12 0x425dbf33 SendMessageW+0x5d() in user32 (0x0032f738)
  13 0x425709b7 ButtonWndProc_common+0xa56() in user32 (0x0032f8a8)
  14 0x4261f1a2 ButtonWndProcW+0x45() in user32 (0x0032f8d8)
  15 0x4261be2a WINPROC_wrapper+0x19() in user32 (0x0032f918)
  16 0x4261bf85 call_window_proc+0xc6() in user32 (0x0032f968)
  17 0x4261e9dc WINPROC_call_window+0x15d() in user32 (0x0032f9b8)
  18 0x425dd807 DispatchMessageW+0x201() in user32 (0x0032fa88)
  19 0x4259988b IsDialogMessageW+0x777() in user32 (0x0032fb18)
  20 0x4259862d DIALOG_DoDialogBox+0x166() in user32 (0x0032fb98)
  21 0x42598892 DialogBoxParamW+0xd3() in user32 (0x0032fbe8)
  22 0x0043a4d4 in wtltest (+0x3a4d3) (0x0032fcec)
  23 0x00439eb7 in wtltest (+0x39eb6) (0x0032fe0c)
  24 0x004554f5 in wtltest (+0x554f4) (0x0032feb0)
  25 0x0045537f in wtltest (+0x5537e) (0x0032feb8)
  26 0x7b854a12 start_process+0x153() in kernel32 (0x0032ff18)
  27 0x7bc7509c call_thread_func+0xb() in ntdll (0x0032ff38)
  28 0x7bc750d5 call_thread_entry_point+0x2e() in ntdll (0x0032ffc8)
  29 0x7bc482b7 start_process+0x1c() in ntdll (0x0032ffe8)
0x00446370: idivl	0xffffffec(%ebp),%eax
Now the questions:

1. Why there is no symbol information(line numbers etc.) for my executable? As far as I know Wine has its own implementation
of imagehlp.dll that deals with debug symbols of PE executables.
On the other hand I downloaded the demo of CrossOver Mac and it
reported the source code information perfectly well.

2. Why there is no symbol information for the Wine modules? AFAIK the default Wine build includes symbol info by default and I have built Wine from source.

3. The annoying "Wine cannot find the FreeType font library.".
Whatever I did I didn't succeed to install FreeType. But.. this is another story...

Does anyone have any idea how to deal with the debugging problems?

Regards.
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Re: Debugging issues on MacOSX

Post by doh123 »

begemott wrote: 3. The annoying "Wine cannot find the FreeType font library.".
Whatever I did I didn't succeed to install FreeType. But.. this is another story...
here is a link to the FAQ that address that....

http://wiki.winehq.org/MacOSX/FAQs#head ... 013f2458c5
James Mckenzie

Debugging issues on MacOSX

Post by James Mckenzie »

Hello,

I have examined different possibilities to run a Windows program on Mac and it seems to me that Wine is the best one.
Since the program I will try to run is complex I decided to test debugging capabilities of Wine.

What I did (tried)?

1. My system is: Mac Mini, Mac OS X 10.6.3.
2. I downloaded Wine 1.1.43 and built it successfully with:

Code:

export CFLAGS="-arch i386 -m32"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-I/usr/X11/include"
export LDFLAGS="-L/usr/X11/lib"

./configure
make depend && make
(I didn't make install)




3. I created a very simple WTL based test application. It is a dialog with two buttons (OK, Cancel). Pressing OK purposely
generates division by zero exception. Then I copied the .exe, .cpp, .h, .pdb files in a /test directory on my Mac.
This may sound strange, but did you compile the application for debugging? Without this the symbol table may be incomplete.

James McKenzie
Usurp
Level 4
Level 4
Posts: 161
Joined: Sat Apr 19, 2008 7:16 am

Re: Debugging issues on MacOSX

Post by Usurp »

doh123 wrote:
begemott wrote: 3. The annoying "Wine cannot find the FreeType font library.".
Whatever I did I didn't succeed to install FreeType. But.. this is another story...
here is a link to the FAQ that address that....

http://wiki.winehq.org/MacOSX/FAQs#head ... 013f2458c5
Hello, if this is the correct FAQ link, it should be updated to state that this is about Freetype not beeing found.
The actual title is only linked to font metrics.
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Re: Debugging issues on MacOSX

Post by doh123 »

Usurp wrote:
doh123 wrote:
begemott wrote: 3. The annoying "Wine cannot find the FreeType font library.".
Whatever I did I didn't succeed to install FreeType. But.. this is another story...
here is a link to the FAQ that address that....

http://wiki.winehq.org/MacOSX/FAQs#head ... 013f2458c5
Hello, if this is the correct FAQ link, it should be updated to state that this is about Freetype not beeing found.
The actual title is only linked to font metrics.
then edit it :-)

the only times I'e had the error about freetype, it went ahead and built font metrics as well... anyways, setting your fallback path should let it find freetype for X
Charles Davis

Debugging issues on MacOSX

Post by Charles Davis »

On 4/30/10 7:20 AM, begemott wrote:
2. Why there is no symbol information for the Wine modules? AFAIK the default Wine build includes symbol info by default and I have built Wine from source.
1) You overrode CFLAGS. The default CFLAGS are '-g -O2'.
2) Wine doesn't support DWARF yet on Mac OS X:

http://bugs.winehq.org/show_bug.cgi?id=22384

As a workaround, use stabs:

CFLAGS="-gstabs+"

By the way, you don't need to specify "-arch i386 -m32", because Wine
already specifies -m32 for you.

Chip
begemott
Newbie
Newbie
Posts: 2
Joined: Thu Apr 22, 2010 8:06 am

Post by begemott »

Hello,

Thank you for your kind replies:

1. export DYLD_FALLBACK_LIBRARY_PATH=/usr/X11/lib fixed the FreeType issue :D

2. I have rebuilt Wine with -gstabs+ switch and now there is symbol info for wine modules! Thank you Charles!

3. The debugger still fails to read the symbol information of the windows executable (I am sure I have built the exe with debug info in pdb format).

Could someone tell me are there any prerequisites to windows debug info format(or source files placement etc.) in principle?

For instance: There is a README file in the wine-1.1.42/programs/winedbg
directory and there are some nice examples of how to debug in Wine(exactly what I want to get).
I noticed the following line:

Code: Select all

bash$ ./wine -debug './dumpexe.exe -symbol ./dumpexe.exe'
Does this mean that the debugger tries to find the symbol info in the
executable? (I suppose this sample is outdated because M$ doesn't
support symbols embedding in executables since Visual Studio 6)

Regards
Locked