Debugger showing wrong info in release mode



My vs 2005 c++ debugger is screwy in release mode, debug mode is fine.
This just started yesterday out of no where.
Does anyone know of this? Is there a setting I toggled by accident
somewhere?

Memory is fine, but debugger shows wrong data in both watch and memory
windows

UNICODE is not defined.
If it is, then the correct data starts at sBuf[2], rather than 4

For some buffer, eg TCHAR sBuf[16]

_tcscpy( sBuf, _T("foobar") );

would show this in debug

sBuf[0] = junk
sBuf[1] = junk
sBuf[2] = junk
sBuf[3] = junk
sBuf[4] = 'f'
sBuf[5] = 'o'

but if you iterate over the buffer and print it, it's correct

sBuf[0] = 'f'
sBuf[1] = 'o'
sBuf[2] = 'o'
sBuf[3] = 'b'
sBuf[4] = 'a'
sBuf[5] = 'r'


// code start
int _tmain(int argc, _TCHAR* argv[])
{
TCHAR sBuf[16];

_tcscpy( sBuf, _T("foobar") );

for( int i=0; i<16; i++ )
{
_tprintf( _T("sBuf[%d] = %c\n"), i, sBuf[i] );
}

_tprintf( sBuf );

return 0;
}
// code end

Thanks for any insight
.



Relevant Pages

  • Debugger showing wrong info in release mode
    ... My vs 2005 c++ debugger is screwy in release mode, debug mode is fine. ... For some buffer, eg TCHAR sBuf ... sBuf= junk ...
    (microsoft.public.vc.ide_general)
  • Re: Setting objects to Nothing uses less memory!
    ... > in debug mode. ... Are you actually running the unit tests under a debugger? ... but whether it's executing under a debugger or not. ... your code is debug code but running without a debugger attached, ...
    (microsoft.public.dotnet.framework.performance)
  • Re: F5 stopped attaching the debugger automatically
    ... nospam@xxxxxxxxxx (John Dalberg) wrote: ... Suddenly I lost the ability to automatically have the debugger attached ... restore the ability to run in debug mode as I always had been. ...
    (microsoft.public.vstudio.general)
  • Re: F5 stopped attaching the debugger automatically
    ... nospam@xxxxxxxxxx (John Dalberg) wrote: ... Suddenly I lost the ability to automatically have the debugger attached ... automatically when I run in debug mode. ...
    (microsoft.public.vstudio.general)
  • Re: Tool for troubleshooting R6025 error in VC++
    ... Since the storage allocation done in release mode is different than that of debug mode, ... memory damage bugs are notoriously difficult to find. ... Hence I don't think it is problem with virtual function call. ... >> The first method should work when running without debugger. ...
    (microsoft.public.vc.mfc)