Difference b/w release & debug

Discussion in 'General Electronics Chat' started by aamirali, Oct 17, 2013.

  1. aamirali

    Thread Starter Member

    Feb 2, 2012
    415
    1
    I read that there are two diff:

    1. Debug settings have debug information with it, while release don't have it.
    2. Debug has lower optimization settings compared to release for better debug view.

    My queries:
    1. What kind of debug information in point 1.
    2. If I set same debug optimization settings as of release then will the code be same.
    3. Keil don't have separte debug & release settings. In "project target" we can select same project with different opt settings but it don't have separate settings for release. So where is debug info in this case
    4. On all Eclipse based & IAR compiler also have separate release & debug settings. In IAR option I check that in option there is macro defined "NDEBUG" if I select release settings. I didn't it anywhere else in project. So what benefit it gives except like certain features can be added like:

    ifndef(NDEBUG)
    // blonk led to indicate debug is attached

    5. What if in my final code, I keep debug setting & change opt level that I need. Will my application will be slower.
     
    Last edited: Oct 17, 2013
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    Since the answer is completely compiler dependent....
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    As noted, the answer is completely compiler dependent.

    In general, a lot of additional code is added that enables you to single step through the code and see which source code line is currently executing. When the code is compiled, the notion of variables changes quite a bit and many source code variables simply go away because they can be combined with other things. The debug code, through whatever mechanism that particular compiler uses, has hooks in the code in order to maintain at least the illusion that those variables still exist. Also, a lot of diagnostic information can be put in so that the debugger can track things.

    The debug version can be significantly larger and significantly slower than the release version. Also, the debug version can contain lots of useful information that a hacker could use to figure out how to find and exploit weaknesses in your code.
     
Loading...