tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] debugging tcc programs with gdb & winedbg


From: Henry Kroll
Subject: [Tinycc-devel] debugging tcc programs with gdb & winedbg
Date: Tue, 30 Nov 2010 03:58:58 -0800

Finally figured out how to get gdb to display source code and step
through a tcc-compiled program. The trick is to do the compiling with
tcc -c -g and then use gcc -g for the linker bits.
$ tcc -c -g g.c
$ gcc -g g.o -o g

windows exe on linux can be made with mingw and debugged with winedbg

I had to modify hello_win to get it to link with mingw (see below).

$ i386-win32-tcc -g -c hello_win.c
$ i686-pc-mingw32-gcc -g hello_win.o -o hello_win.exe -mwindows

Wine-dbg>break WinMain
Breakpoint 1 at 0x0040146a WinMain+0xa [hello_win.c:92] in hello_win

Wine-dbg>cont
Stopped on breakpoint 1 at 0x0040146a WinMain+0xa [hello_win.c:92] in
hello_win
WinMain () at hello_win.c:92
92          pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!";

Wine-dbg>list 89,97
89          static WNDCLASS wc;//STATIC instead of ZeroMemory
90          HWND hwnd;
91      
92          pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!";
93      
94          // Fill in window class structure with parameters that describe
95          // the main window.
96          // COMMENT THIS OUT TO GET IT TO LINK WITH MINGW
97          //ZeroMemory(&wc, sizeof wc);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]