Debug & release mode
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: Debug & release mode

Hybrid View

  1. #1
    Join Date
    Apr 2013
    Posts
    77

    Debug & release mode

    One of my win32 application working fine in debug mode.but malfunctioning in release mode.Can i do debug operation on release mode?I tryed to debug in release mode,But valuse showing is not correct.How to solve this problem?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Debug & release mode

    Quote Originally Posted by manjut19 View Post
    One of my win32 application working fine in debug mode.but malfunctioning in release mode.
    Well, you are not the first having such a problem. See Surviving the Release Version

    Quote Originally Posted by manjut19 View Post
    Can i do debug operation on release mode?
    Yes, you can. See How to: Debug a Release Build

    Quote Originally Posted by manjut19 View Post
    I tryed to debug in release mode,But valuse showing is not correct.How to solve this problem?
    Fix your bugs.
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2013
    Posts
    77

    Re: Debug & release mode

    Well, you are not the first
    Yes, you can. See How to: Debug a Release Build
    I made changes on Project property to debug my relaese build,But still i am not getting the correct values for the variable,
    Suppose i have written
    Code:
    int a=10;
    Add watch for a will show zero,Like that happening,Second thing,Now i canot debug my debug build one.What to do, i am entirely stucked.Please help me
    Last edited by manjut19; August 29th, 2013 at 12:40 AM.

  4. #4
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Debug & release mode

    Quote Originally Posted by manjut19 View Post
    I made changes on Project property to debug my relaese build,But still i am not getting the correct values for the variable,
    Did you turn off optimizations? If you're debugging an optimized build, then the code that you're running is not going to match your source code.

    You need to disable optimizations and rebuild your application.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Apr 2013
    Posts
    77

    Re: Debug & release mode

    Quote Originally Posted by Paul McKenzie View Post
    Did you turn off optimizations? If you're debugging an optimized build, then the code that you're running is not going to match your source code.

    You need to disable optimizations and rebuild your application.

    Regards,

    Paul McKenzie
    Now i disabled Optimization in my release version,So i can debug my release build,But then i have a doubt , what is the use of debug mode,if we can directly debug and trace the problem from release build?

  6. #6
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Debug & release mode

    Quote Originally Posted by manjut19 View Post
    Now i disabled Optimization in my release version,So i can debug my release build,But then i have a doubt , what is the use of debug mode,if we can directly debug and trace the problem from release build?
    You are getting confused with what a "debug" build is.

    All you're doing when you turn on debugging is generating the necessary information to generate .PDB file. That PDB file is then matched with the source code. You can turn on debug symbols for any configuration, whether it is called "Release", "debug", "ReleaseWithMyOwnStuffAdded", etc. Similarly, you can turn off debugging when you choose the "Debug" configuration.

    Now, when the preprocessor symbol "DEBUG" is defined, it pulls in extra code that allows heap analysis, checking for invalid pointers etc. That's all -- nothing else. It doesn't turn on or off generating information necessary for the debugger to work. That is done in the Linker and Compiler options for Debugging.

    Regards,

    Paul McKenzie

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Debug & release mode

    There may be a lot of...
    Different environments, working directories, and so on.
    Do you, for example, open some file using its relative or some hard coded path?
    In any case you have to check the return values of all the APIs you call and signal somehow if they failed...

    See more here
    Victor Nijegorodov

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Debug & release mode

    At first you must locate it. Where in your code does it happen?
    What is the exact error message? Address?
    Sometimes you can finf this info in the Windows event viewer.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center