Protection Violation in Release Build but not in Debug Build 
Author Message
 Protection Violation in Release Build but not in Debug Build

We have run into a problem where an app is blowing up in its Release
Build but appears to be behaving properly in its Debug Build.  App
is built using VC++ 6.0 and is running on NT4/SP4.  The problem
appears to occur while the application is throwing an exception.
We can actually affect the behaviour of the bug by the size of the
strings we used in the AFX Msgboxes we were using in attempting to
isolate the problem.

Can anyone shed any light on what types of bugs show up in release
but not in Debug?  Also are there any tools available which will
help in solving this problem.

TIA

Timothy Zachmann



Tue, 23 Apr 2002 03:00:00 GMT  
 Protection Violation in Release Build but not in Debug Build

Quote:
>We have run into a problem where an app is blowing up in its Release
>Build but appears to be behaving properly in its Debug Build.

Timothy,

You can debug the release build if you set the "Generate debug info"
option on the Linker tab of the Project Settings dialog (for the
release build), and enable the "Debug info" on the C/C++ tab.

Dave
--
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Wed, 24 Apr 2002 03:00:00 GMT  
 Protection Violation in Release Build but not in Debug Build
(I see you use MFC)

A very nice problem is the use of incorrect message handlers. "Incorrect"
means especially the return types. If a handler is written to return "void"
but the original signature of the handler requires "BOOL" then a crash only
happens in the release. This is one of the most occuring differences between
debug and release. Oftenly a message map entry (the macro) is changed in
later development but the handler remains it's old signature. Check all your
message maps, the entries and the prototypes of the handlers.

Torsten



Quote:
> We have run into a problem where an app is blowing up in its Release
> Build but appears to be behaving properly in its Debug Build.  App
> is built using VC++ 6.0 and is running on NT4/SP4.  The problem
> appears to occur while the application is throwing an exception.
> We can actually affect the behaviour of the bug by the size of the
> strings we used in the AFX Msgboxes we were using in attempting to
> isolate the problem.

> Can anyone shed any light on what types of bugs show up in release
> but not in Debug?  Also are there any tools available which will
> help in solving this problem.

> TIA

> Timothy Zachmann



Fri, 26 Apr 2002 03:00:00 GMT  
 Protection Violation in Release Build but not in Debug Build


<debug seems to work, release fails>

There are differences between debug and release.
Debug information provides a "pad" that can mask
errors because the mistake can occasionally only
affect the debug info.  And release involves the
optimizer which can move stuff around in ways you
may not expect.

If you use assert (and you should) look for doing
stuff that you should not.

ASSERT( i == 0)

is fine,

ASSERT( i++ == 0)

is not.

Look for improperly initialized variables, especially
pointers.

Look for off-the-end errors where you walk off an
array or linked list, either end.

Look for places where you depend on things being in
memory in a particular order.  Especially look for
strings that may get moved by optimization. If you
have "Error!" in two places in the code, you may
only get one instance after optimization, and that
may not be close to the rest of the code near either
original instance.

Use the divide-and-conquer method. In a copy of your
project, take out half the code. If the bug stays,
take out half of the remaining. If the bug goes away,
keep the other half.  Keep doing this till you find
the specific chunk of code that has the problem.
Also, splitting the code this way can make the bug change
it's specific manifestation, and so make it easier to spot.

Use brute force debugging.  Put in fprint statements
or fprintf statements that record where the program
has gotten to. Or use message boxes.

Long term, use the de{*filter*} to step through new code
as soon as you type it in.  Look at every variable
and make sure it is doing exactly what you expected.
Use the de{*filter*} to exercise every loop in your code,
especially rarely used error handling routines.

--
Dan Evens
Standard disclaimers etc. No spam please.



Fri, 26 Apr 2002 03:00:00 GMT  
 Protection Violation in Release Build but not in Debug Build
We find that Mutek's (www.mutek.com) BugTrapper product is very helpful in
these situations. It nicely complements de{*filter*}s and heap-checking tools.
Check it out!

tr.


We have run into a problem where an app is blowing up in its Release
Build but appears to be behaving properly in its Debug Build.  App
is built using VC++ 6.0 and is running on NT4/SP4.  The problem
appears to occur while the application is throwing an exception.
We can actually affect the behaviour of the bug by the size of the
strings we used in the AFX Msgboxes we were using in attempting to
isolate the problem.

Can anyone shed any light on what types of bugs show up in release
but not in Debug?  Also are there any tools available which will
help in solving this problem.

TIA

Timothy Zachmann



Sat, 27 Apr 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Error in Release build but not Debug build

2. Q: Dialog Tooltips work in DEBUG build but not under RELEASE Build

3. Debug build breaks, Release build ok

4. Debug Build vs. Release Build

5. Debug Build works Release build doesn't?

6. Debug build works correctly but release build doesnt (sometimes)

7. Debug build works, release build crashes!

8. Message Handler on Release build and debug build

9. VC6 Debug Build Works Fine - but Release Build Gives Error

10. Differences between release builds and debug builds?

11. Debug build breaks, Release build ok.

12. Worker Thread and MDI app - Release Build dies but Debug Build OK

 

 
Powered by phpBB® Forum Software