Thread: dumpbin with debug and release version

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    dumpbin with debug and release version

    Hello everyone,


    Could dumpbin be used to check whether an executable or a DLL (written in Visual Studio C/C++ native unmanaged) is debug version or release version? I use /headers option but can not see any differences.

    If dumpbin can not be used to check debug or release, any other tool could be used?


    thanks in advance,
    George

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    The debugging symbols are used by the debugger, so I'd expect that it can tell whether a runtime has them or not.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Aside from symbols, I don't THINK there's any information stored in the executable file. And of course, there's no "law" against including symbols in a release build if you really want to - you may find that it's hard to debug the code, but it's perfectly valid.

    --
    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.

  4. #4
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    If u'r executable was compiled in debug and if u wanted to debug it only by the debug utility (gbd) can identify that the exe has a debug information. Perhaps u might know as well. Cos when u compile the code u might have raised -g option to include the debug information as well. That can be read only by the gdb. dunno about windows.

    If you do not raise any flags (-g) at the time of compilation u wont get those information included in your exe file.

    ssharish

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    There's no clear difference between "debug" and "release." It boils down to a set of flags. By definition, any code you release is a "release version." So in general this question can only be answered by asking somebody if it is meant for debug or release.

    You can detect the presence of various debugging segments with a binary dumper. That tells you if symbolic debugging is enabled. But that doesn't necessarily mean you have a "debug build," you just have a build with debug info in it. Also, a build without debugging symbols might actually count as a "debug build" because it has certain options enabled -- extra logging, assert() checking, etc. Or maybe it has some preprocessor macro MY_MAGIC_DEBUG defined.

    What makes something a debug build or a release build is merely whether somebody says so, what the intent is.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ssharish2005 View Post
    If u'r executable was compiled in debug and if u wanted to debug it only by the debug utility (gbd) can identify that the exe has a debug information. Perhaps u might know as well. Cos when u compile the code u might have raised -g option to include the debug information as well. That can be read only by the gdb. dunno about windows.

    If you do not raise any flags (-g) at the time of compilation u wont get those information included in your exe file.

    ssharish
    This applies to gcc. Based on previous posts (and the fact that "dumpbin" is mentioned here), I think George is using MS Visual Studio tools - I could be wrong of course.

    And a solution to the original problem would be to add a text-string that gets printed under some circumstances [e.g "app --version"] that is relying on the build mode e.g.:
    Code:
    #if _DEBUG
    char *build = "Debug";
    #else
    char *build = "Release";
    #endif
    Of course, there is no rule that says that Release" can't have "_DEBUG" defined to 1!

    --
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug release conf problem
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 03-20-2009, 04:39 PM
  2. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 04:00 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. Replies: 2
    Last Post: 05-22-2004, 02:10 AM
  5. Why does this crash in release version but not debug?
    By Dual-Catfish in forum C++ Programming
    Replies: 1
    Last Post: 04-03-2002, 06:19 PM