Re: Debug vs. Release



Hi Johnny!
I feel hard to write an brief example to explain the matter of
breakpoint.
"The debugger associates breakpoints with a selected line number in the
source code.  But in release build code the relationship between source
code lines and the optimized machine code can get pretty vague: There
may be no specific place in the machine code that corresponds to the
source line. "

Can anyone help me?


A simple example:

<code>
#include <tchar.h>
void DoSomeUselessStuff(int i)
{
  int a = 0;
  for (int k=0; k<i; k++)
    a += i;
}

int _tmain()
{
  DoSomeUselessStuff(12);
}
</code>


In debug-builds, you can set a breakpoint into the function "DoSomeUselessStuff".
In release builds (/O2) you can´t... (the function will not be there)


--
Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/
.



Relevant Pages

  • Re: Debug vs. Release code.
    ... >> build is run in VS.NET, assuming symbols have been generated, it can ... > It will not stop on your breakpoint. ... Symbols are used to 'link' source code to the run time code. ... still attach a debugger to a process even if it is in release mode. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: In writting debugger, how can the program be stopped when breakpoint is encountered?
    ... > In writting debugger, how can the program be stopped when breakpoint ... Breakpoint at a specific source line ... 1.the debugger figures out where does the machine code corresponding to line 12 start, by looking in the debug infos compiled with your program ... 2.the debugger replaces the machine code instruction at that address with a specific instruction that branches to the debugger ...
    (comp.os.linux.misc)
  • Re: Debug vs. Release code.
    ... although it is possible to attach a debugger ... >> It will not stop on your breakpoint. ... > Symbols are used to 'link' source code to the run time code. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: [Kgdb-bugreport] [PATCH][2/3] Update CVS KGDBs have kgdb_{schedule,process}_breakpoint
    ... >>comments to the user at or around the breakpoint. ... >>to tell the user about where the info files are or some such. ... >>then come up on his screen when the source code at the breakpoint is ... I don't want to try to send messages to the gdb ...
    (Linux-Kernel)
  • Windows 7, VS 2005 and breakpoints
    ... I have created a brand new WinForm project with one ... message is "The breakpoint will not currently be hit. ... The source code is ... I have VS 2005 loaded with SP1 and SP1 fix for Vista ...
    (microsoft.public.vsnet.debugging)

Loading