Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

harryx

How to debug in release mode? (vc++)

This topic is 5970 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My program only crashes when run in release mode, so I cannot find out where it is going wrong. Is there any way to use the debug information given in release mode to find out where it went wrong in my code? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster

Not really.

Try printing out or wiriting to a file to narrow down the lines that are crashing your code.

Release only crashes are usually because you used a variable with allocating or initializing it. Debug puts default values in variables, but release mode does not.

Share this post


Link to post
Share on other sites
Thanks but I think my problem is slightly nastier than this.

I am creating and deleting a fair number of texture objects in opengl, and I think that this is causing my memory to become fragmented which is leading to this problem.

Its either that or the fact that I am also creating and deleting a large amount of geometric data, which could also be causing it.

Id just like to know which it is...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by harryx
Thanks but I think my problem is slightly nastier than this.

I am creating and deleting a fair number of texture objects in opengl, and I think that this is causing my memory to become fragmented which is leading to this problem.

Its either that or the fact that I am also creating and deleting a large amount of geometric data, which could also be causing it.

Id just like to know which it is...





It''s neither. That would also crash you in debug if it crashes you at all. You''re probably reading from a block of memory without writing to it first, deleting something before you were really done with it (Debug sometimes is OK with that) or accessing past the end of an allocated chunk somewhere (Debug also lets you get away with that, since it tends to ''pad'' your memory.)

Fragmentation has nothing to do with it.

Share this post


Link to post
Share on other sites
If you''re using MSVC, you can add debug info to a release build by going to Project->Settings, change "Settings For:" to Win32 - Release, goto Link and check "Generate Debug Info". Next, go to C/C++ and change "Debug Info:" to "Program database for Edit and Continue".

Recompile and you should be able to see all the symbol names and whatnot. Just be away that when stepping through optimized code, the cursor may jump around a bit as the compiler may remove/rearrange code for better performance.


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
Quite right Dean. Also, you can only really tell for sure what function you are in--the compiler is free to do all sorts of whacky things, so even watch symbols can''t be trusted half the time.

Share this post


Link to post
Share on other sites
Thanks for the help,

I set up release mode as suggested, however when I hit f5 and start debugging (in release mode) I dont get the crash - although I do if I start with ctrl+f5 but then I dont get any useful debug info.

Basically generating debug info in release mode seems to avoid the crash in the same way as running in debug mode does.

The crash is seemingly random (ie I can test it once and it will crash, I then copy exactly what I did before and it doesnt crash)

This is why I was thinking it is something obscure like fragmented memory.

Any ideas?

Share this post


Link to post
Share on other sites
what is the benefit of running in release mode?
i''ve noticed a smaller executable, but thats about it.

~ I am a DirectX to OpenGL convert! ~

Share this post


Link to post
Share on other sites
quote:
Original post by GekkoCube
what is the benefit of running in release mode?
i''ve noticed a smaller executable, but thats about it.

Non debug libraries (generally), for one thing, which are what clients/end-users are likely to have installed. If you released a commercial application built using debug libraries, only developers with those libraries installed would be able to run them.

Also, release mode strips out the debug information which a cracker could find very useful...

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!