I use mingw/msys on windows and use notepad as my ide so I have TONS of
experience debugging without a debugger.
Do you know how I do it? Log files!
When my program starts up I have it clear the log file, and then in places
where I need to know what’s going wrong, I make it output the values of
variables to the log file, or I just have it output text and debug that way.
Let’s say your program crashes and you’re trying to find out where it
crashes. What I do is in my main loop I put a couple log statements in
there like one at the top of the loop, one at the bottom of the loop and a
couple in the middle, then I run the program and make it crash.
When I look in the log file, I’ll know where it crashed because I’ll know
it’s somewhere between where it outputs the message that’s the last message
in the log file and the next message.
Then, I refine my search by putting more log outputs between those 2
statements, or by going into the function calls and putting log output in
Continue until you find the statement that causes the crash, then start
outputting the values of variables at different points in the code to find
what’s going wrong and why.
It works really well for me, and should work well for you too (:
These are 2 functions that should help you a lot:
printf(“Could not open log.txt for writing”);
void Log(char *Message,…)
printf(“Could not open log.txt for append\n”);
The good thing about the above log function is that it works exactly like
printf, so that means you can do things like this:
Printf(“Playercount is %i and server name is
And it will output the text and the values of the variables to the log file.
Also you’ll notice the file is opened and closed with every Log() call.
This is because when a program crashes sometimes it doesn’t flush the file
buffers so you can lose parts of your logfile that you’ve written if you
don’t close after every entry which can lead to some confusing debugging!
Hope this helps!
Aln> ----- Original Message -----
[mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of Michael Ryan
Sent: Friday, May 26, 2006 8:53 AM
To: sdl at libsdl.org
Subject: [SDL] Debugging fullscreen on Mac
Can anybody give me advice on debugging SDL full screen apps? I’ve got a
game that uses windowed and full screen modes on Mac OS X. I start the game
in windowed mode and switch the game to full screen. I follow the debugger
through to the SDL_SetVideoMode call. When this is called, the switch is
made to full screen, but I only get a black screen with the mouse pointer.
At this point, my Mac crashes and I can’t do anything.
Any help is greatly appreciated.
SDL mailing list
SDL at libsdl.org