Thread: Using the Debug mode ((F10) V.S 2005

  1. #16
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by matsp View Post
    Are you sure you don't get a compiler error or some other inconsistency in your building of the application? Try doing a complete rebuild (clean build) of all your code. The usual cause for these things is that the code the compiler generated, and the source code that the debugger is showing, are out of sync.

    --
    Mats
    I've compiled each file in my project separately.. No Errors/warnings

  2. #17
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by Elysia View Post
    You do realize that F10 steps over, right? It will execute the entire function and break afterwards.
    Just making sure that I'm understanding you right.
    I press CNTRL+F10 to run to cursor... then press F10 to make sure i debug/step on every single line thereafter... In this, my function gets skipped... Even if i try running inside that function (CNTRL+F10), the code never gets there....

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    F10 is step over. It executes any functions without stepping into them.
    To step in, use F11.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #19
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by Elysia View Post
    F10 is step over. It executes any functions without stepping into them.
    To step in, use F11.
    i know that Elysia... I had to delete all project files and created a new project with new names... Add all my files and now works fine...

    May have to do with the changes i made (from Debug to Release mode), don't know really

  5. #20
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    In Release, debugging can be somewhat more difficult because the compiler can inline and remove code (optimize), thus it may be seen as stepping over something it shouldn't or jump around erratically and other things. This is normal.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #21
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    In Release, debugging can be somewhat more difficult because the compiler can inline and remove code (optimize), thus it may be seen as stepping over something it shouldn't or jump around erratically and other things. This is normal.
    Indeed - the compiler will re-arrange the code A LOT when optimizing in release-mode, and setting a breakpoint in a function that is inlined will often lead to the breakpoint being skipped. It may also move variable assignments around in relation to functions or if/for/while statements (you have a = 1 before a statement, but the compiler decides that you are not using a until after the statement, so let's move it down a bit). Variable displaying in optimized code is also often flawed, since variable content may skip from one register to another, and sometimes be stored in memory and at other times in a register. The debugger can often be confused by this sort of variable "variability". Another side-effect of optimization may be that variables completely disappear, and that a variable used to count up from 0 to 999 becomes a count down from 999 to 0 because to the logic of the code, all that matters is that it counts 1000 steps, not whether it goes up or down - and counting down saves one instruction compared to counting up - which matters to the compiler. But this also means that your loop variable may not appear in the way you expect it.

    In summary, the compiler may do anything it likes that doesn't change the outcome of the code itself. This makes it very tricky to debug the optimized code - I find it easier to follow the assembler code rather than the source code when debugging optimized code - but that probably comes from a long experience in debugging assembler code.

    If it is possible to reproduce the bug with debug mode, then use that fore debugging. If you can only reproduce the bug in release mode, then you have to struggle with it.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #22
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The idea is to do the debugging in debug mode. The debugger is completely unreliable in release mode and as others have said it will skip breakpoints and refuse to show data to you in watches.

    However I've not had a problem debugging console apps with VS 2003 or 2005. Not sure what the problem is here but I have no issues. You can output to the screen just fine and click on your app in the task bar and it will repaint itself. I debug console apps all the time at work and rarely need to use my second monitor. You could remote debug the app but then that is overkill.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  2. Why my code works only in debug mode?
    By pingpangpang in forum C++ Programming
    Replies: 3
    Last Post: 06-04-2007, 12:39 PM
  3. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 11:08 AM
  4. Debug Mode Vs. Release Mode
    By incognito in forum Tech Board
    Replies: 5
    Last Post: 12-18-2003, 04:06 PM
  5. 2min in debug mode, 3sec in release!
    By glUser3f in forum C++ Programming
    Replies: 9
    Last Post: 10-03-2003, 01:00 PM