Advertisement

How do you debug graphics programs?

Started by October 15, 2007 01:31 AM
5 comments, last by Vern777 17 years, 1 month ago
I made a simple program in Linux using Ogre 3D engine. My question is how do you debug it? I'm using auto tools to setup my project. I know I can use make debug=yes to compile in debug mode. I run GDB from inside emacs. Okay this works fine. But now I want to continue stepping through my program, or setup a break point. The problem I'm having is when I break, my computer locks up, and I'm unable to return to the debugger. I'm guessing that once switched to the debugger, my program loses keyboard and mouse, thus locking up. How do I switch out of my current program and into the debugger? The only thing I can do is ctrl-alt-f2, log in, then kill my program. Any ideas?
I personally debug using dual monitors. Run the debugger on one monitor, and your graphics program (I am assuming fullscreen) in the other.

This is the only way I know of, besides emulation.
Advertisement
Why not run your debugger in tty2? Login at the terminal and inform it of your already running X display ("export DISPLAY=:0.0" by default). Then run gdb or emacs, execute your program, and switch back to X. When a breakpoint is hit, switch back to tty2.
Sometimes the simplest and fastest thing to do is skip the debugger and just to do a printf() of key vars from with-in the functions where you have problems...

_|imothy Farrar :: www.farrarfocus.com/atom
Quote: Original post by TimothyFarrar
Sometimes the simplest and fastest thing to do is skip the debugger and just to do a printf() of key vars from with-in the functions where you have problems...
This is not debugging. This is stabbing needles into your program in the vague hope that eventually something useful will spill out of the holes. It might work (and once in a while it's actually an effective tactic), but it's basically accidental.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote: Original post by Promit
This is not debugging. This is stabbing needles into your program in the vague hope that eventually something useful will spill out of the holes. It might work (and once in a while it's actually an effective tactic), but it's basically accidental.


Analogy awesome, point doesn't apply to all folks.

I haven't touched a debugger in about 10 years, and haven't needed to either (not even gdb to get a stack trace). Seriously, there is nothing accidental about really knowing the code you write enough to know where it might fail before it does!

Different tools for different people, sure some people like to hammer in nails with a hammer, others a nail gun, and for some people a nice rock works just fine!


_|imothy Farrar :: www.farrarfocus.com/atom
Advertisement
Thanks for the comments, sorry about late reply, busy.

This topic is closed to new replies.

Advertisement