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.
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:
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.