Click to See Complete Forum and Search --> : HowTO: debug Release build
Will Rothwell
May 26th, 1999, 09:59 AM
Hi all,
My app. work correctly in debug, as I can use TRACE and debug to check all is well. However, when I made a Release Build the program does not work the way it should. The Release Build compile and link OK.
Please advise what could I have done wrong, and how to correct this. Can I do something like TRACE in debug mode? Thanks in advance.
Will
Bevan
May 26th, 1999, 10:56 AM
Unfortunately, once your in release build all the debug information is stripped out, so to speak. Actually, it is just not added. If you're fond of Assembly then you can use a map file to locate errors (But this is a whole new discussion). Otherwise, you're probably left with adding MessageBoxes and analyzing other program behavior to tell you where your at and what the program is doing.
Visual C++ ships with some tools that may help, by showing fired messages, etc., but, I'm not familiar enough with them to advise.
chiuyan
May 26th, 1999, 01:39 PM
You can build your release version with Debug info, & then debug it as you would the debug version (you may need to turn code optimization off). Just go to your project settings C/C++ tab and select Program Database for the Debug Info, and then go to the Link tab and click the Generate Debug Info check box. Then you can debug your program as normal.
There is also a function called OutputDebugString, which acts just like the TRACE statement, except it also outputs in release builds. You can replace your TRACE calls with this function call.
Also, 99.99% of release-build related errors are un-initialized variables. Make sure that all your variables are being initialized to something good before you use them (in Debug mode, all vars are initialized to 0).
--michael
Jerome
May 26th, 1999, 01:51 PM
1st thing to look for: functions or statements inside TRACE() macros (not executed in release mode). Second thing: wrong or missing function parms, particularly like ommitting WPARAM/LPARAM args in message functions. If basic MessageBox() debugging doesnt help, you can always use OutputDebugString() even in release mode.
Paul McKenzie
May 26th, 1999, 02:15 PM
Actually, you can debug a release build with full symbols as was stated by another post. The debug information is stored as .PDB and .DBG files. If you ever install the NT version with debug symbols (a bunch of very large .DBG files), you can get the names of the NT kernel routines called when an exception occurs, instead of a bunch of assembly addresses in the call stack.
However, you are correct if you don't have the source code or do not have .DBG files.
Regards,
Paul McKenzie
acrown
May 26th, 1999, 05:25 PM
The best solution I can recommend is to always plan for debugging when developing your code and don't rely on stuff provided by the vendor. I generally build code so that it generates a log file. In that way, I can always tell what the heck its doing. I configure the operation of the program via a config file so I can selectively enable/disable various printouts. I never remove debug code from my software just disable it.
Will Rothwell
May 27th, 1999, 06:44 AM
Hi gurus,
Thank you very much for your suggestion. It certainly make this painful world of arm-wresting with VC++ a happier place to live in.
The tips work !!
Will
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.