Sign in to follow this  
comfortablynumb84

Can't debug my SDL application.. :(

Recommended Posts

Hi! I have VS2005EE.. and I'm starting to learn some debugging tips. I tried to debug my SDL tetris version and I couldn't get the "step by step" debug function to work. I want to see step by step my program so I can find some memory leaks and some bad variables assignations. How can I debug SDL applications under VS2005EE? I put SDL_INIT_NOPARACHUTE on my SDL_Init() and I also changed an environment variable, SDL_VIDEODRIVER to windib so it uses GDI and not DirectX ( I saw in SDL's homepage that it could work changing that variable but it doesn't :( ). Anyway.. I hope you understand what I'm trying to mean. As I always say.. my english is awful :P Thank you in advance.

Share this post


Link to post
Share on other sites
I've never used SDL, but I can't see why it wouldn't work.

I checked up the flags you mentioned, it got nothing to do with debugging. I doubt using DX would stop you from debugging anything (might be wise to install the SDK though) and
"DL_INIT_NOPARACHUTE Prevents SDL from catching fatal signals."
Seem like a failsafe flag to the library that's all.

First, make sure you set your solution configuration to Debug and not Release (the combo box in the toolbar at the top of the screen). Then, make sure you start in debugging mode (F5) and not in normal mode (Ctrl+F5 or running the .exe directly). I guess you already know that but we never know :). You can also start with F10 to make the thing break at the first line of your main (which should work whether you use SDL or any other lib) instead of breaking on breakpoint or by pressing the pause button.

It would be nice to know exactly why it "won't work". What happens?

Share this post


Link to post
Share on other sites
First of all, thank you for your fast answer!

I set version to "debug version" instead of release and I'm on debug mode. What it happens when I press F10 is that it opens disassembler and, when I press F10 two or three times.. it opens the app window and I can play my game as it wouldn't be on debug mode! it doesn't go step by step like any other application that I tried before (I tried "step by step" with a few little apps. Pressing F10 it went line by line and it showed me every variable or pointer that it spotted).

I need to debug my app because it has a lot of memory leaks and it's so difficult to find them without this tool.

Again, thanks for your help :)

Share this post


Link to post
Share on other sites
Sounds like your not setting any breakpoints.

Pressing F10 will execute a line of code before giving control back to the debugger. If you press F10 on 'MyGameLoop();' you wont get to debug anything until MyGameLoop() has finished.

Set some breakpoints or press F11 to STEP-INTO the function call.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this