Sign in to follow this  
hotdogsayhi

When use Debug mode? When use Release mode?

Recommended Posts

Quote:
Original post by hotdogsayhi
When should i use Debug mode?
When should i use Release mode?
Can i only use release mode when i am programming?
Debug mode generates a lot of extra information, which helps your debugger understand your program, and it also disables certain optimisations that would make it hard/impossible to debug. Release mode performs these extra optimisations, and strips out all the debug data, leaving a smaller, faster program.

In general, you want to use debug mode while developing your software, and release mode when you ship to customers.

Share this post


Link to post
Share on other sites
Also, you frequently need to have the compiler installed to run a debug program. Release programs should be able to run on computers without the compiler (though sometimes they still need some redistributables, but that's another thread).

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
Also, you frequently need to have the compiler installed to run a debug program. Release programs should be able to run on computers without the compiler (though sometimes they still need some redistributables, but that's another thread).


I have never had problems running debug apps on a machine with no compiler installed, although i use release normally, i had a model loader which failed in release so tried it on other machines in debug build (with msvc runtime dubug dlls).all works fine and i finished the project, is this bad?

Share this post


Link to post
Share on other sites
Quote:
Original post by BlackSeeds
Quote:
Original post by Ezbez
Also, you frequently need to have the compiler installed to run a debug program. Release programs should be able to run on computers without the compiler (though sometimes they still need some redistributables, but that's another thread).
I have never had problems running debug apps on a machine with no compiler installed, although i use release normally, i had a model loader which failed in release so tried it on other machines in debug build (with msvc runtime dubug dlls).all works fine and i finished the project, is this bad?
I think Ezbez was referring to the need to distribute debug DLLs with a debug executable. In general, a debug build should run just fine on other machines, and even some commercial software is shipped with debug symbols enabled (to allow remote debugging).

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by hotdogsayhi
When should i use Debug mode?
When should i use Release mode?
Can i only use release mode when i am programming?
Debug mode generates a lot of extra information, which helps your debugger understand your program, and it also disables certain optimisations that would make it hard/impossible to debug. Release mode performs these extra optimisations, and strips out all the debug data, leaving a smaller, faster program.

In general, you want to use debug mode while developing your software, and release mode when you ship to customers.


in what situation, debug mode can help the debugger while release mode can't?

Share this post


Link to post
Share on other sites
Quote:

in what situation, debug mode can help the debugger while release mode can't?

Almost all? Release mode optimizations drastically transform your code. This includes instruction reordering, removal, and function inlining. Combined with many other changes to the code it becomes impossible to put breakpoints that 100% line up with a line of code you wrote. Some variables can no longer be inspected in the debugger as they no longer exist in the form you see in code.

All this boils down to making it really hard to see exactly what exactly is wrong with your code. And even worse, makes it hard to move around the code and set/inspect variables to see where your logic is going wrong.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
I think Ezbez was referring to the need to distribute debug DLLs with a debug executable.


Also you'll find the Visual Studio EULA strictly forbids distributing the debug versions of the standard runtime DLLs.


There is no clear distinction between what is 'Release' and what is 'Debug', other than release being as fast and small as possible, and debug most helps you test your program. Sometimes I turn on some optimisations in my debug version because I need speed and I'm confident my assert()s will catch any bugs. I've heard of some desperate people who ship their release versions without optimisations because they have some bad bug that only appears when it's turned on. I always generate debugging info for my release version to help translate crash logs, but you don't actually need to distribute this with the exe (with Visual C++).

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
In general, you want to use debug mode while developing your software, and release mode when you ship to customers.


Personally, I do most "normal" testing with the release version because the differences in the generated code between release and debug can sometimes manifest bugs that you don't see in debug mode (e.g. the way debug mode typically initializes variables differently to release). So often a problem that works fine in debug mode will crash in release.

I only use the debug build when actually debugging (ie with the debugger attached).

It's still possible to attach a debugger to a release build, but as others have said, it can be a bit strange the way things jump around and you can't "see" many of the variables in your code. Sometimes you don't have a choice, though...

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