Thread: How can i remove debugging information

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    183

    How can i remove debugging information

    some friend told me in networking programs when u remove debugging information exe gets smaller i wanted to ask where can i remove debugging information at msv6
    and also what does makes the exe smaller or bigger.
    thanks in advanced.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    In visual studio, I don't think there is much debug info in the executable itself, as it is stored in a .pdb file that is separate from the executable itself. In Linux/Unix, the debug is embedded into the executable file, and using the "strip" command will remove any debug information, including symbol info.

    Compiling your code for release mode will (usually) reduce the size of the executable.

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

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It contains some slight debugging information, but not enough to radically increase the size.
    I don't know how to do it in MSVC6 either, though.
    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. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by matsp View Post
    In visual studio, I don't think there is much debug info in the executable itself, as it is stored in a .pdb file that is separate from the executable itself. In Linux/Unix, the debug is embedded into the executable file, and using the "strip" command will remove any debug information, including symbol info.

    Compiling your code for release mode will (usually) reduce the size of the executable.

    --
    Mats
    You have several options in Project Properties C/C++ General
    Debug Info

    - None - none is added
    - Line Numbers Only - as it stated
    - C7 Compatibale - Debug info is stored inside the exe-file (no need for pdb file)
    - Progam Database - Debug info is stored in the pdb file
    - Progam Database for edit enad continue - Same as above Plus additional possiblity to fix code and continue debugging without restarting the application
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by vart View Post
    You have several options in Project Properties C/C++ General
    Debug Info

    - None - none is added
    - Line Numbers Only - as it stated
    - C7 Compatibale - Debug info is stored inside the exe-file (no need for pdb file)
    - Progam Database - Debug info is stored in the pdb file
    - Progam Database for edit enad continue - Same as above Plus additional possiblity to fix code and continue debugging without restarting the application
    But normally, it's set to NONE for release build, as far as I remember, and C7 is not at all meaningfull unless you try to use REALLY OLD debug tools (like 10+ years old!)

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

  6. #6
    Registered User
    Join Date
    Dec 2008
    Posts
    183
    yah i found it its on build configration and make it release without win32 debug

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by matsp View Post
    In Linux/Unix, the debug is embedded into the executable file, and using the "strip" command will remove any debug information, including symbol info.
    I'm presuming the debug symbols are only present if you compile with "-g", and that "strip" undoes the "-g". Am I wrong?

    Yep...wow look at that...
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by matsp View Post
    But normally, it's set to NONE for release build, as far as I remember, and C7 is not at all meaningfull unless you try to use REALLY OLD debug tools (like 10+ years old!)

    --
    Mats
    I like to use C7 option when I need to debug on the different comp using attach to Process feature from where I have compiled the exe - in this mode it never happens that the debug info is not found by the debugger.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  9. #9
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by MK27 View Post
    I'm presuming the debug symbols are only present if you compile with "-g", and that "strip" undoes the "-g". Am I wrong?

    Yep...wow look at that...
    strip removes ALL sections from the image which are unnecessary for program execution. Not just debug info.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2009, 07:54 PM
  2. Replies: 13
    Last Post: 04-05-2009, 10:16 AM
  3. displaying debug information
    By steve1_rm in forum C Programming
    Replies: 10
    Last Post: 02-17-2009, 11:36 AM
  4. debugging information corrupt
    By silk.odyssey in forum C++ Programming
    Replies: 2
    Last Post: 07-28-2004, 04:52 AM
  5. using information from an array
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 12-07-2001, 05:30 PM