1
視窗7 64位,Visual Studio 2010中,控制檯C++應用程序,Win 32調試配置:不正確的調試
#include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { char* p = NULL; *p = 1; return 0; }
開始調試。很顯然,我得到這個錯誤messsge:
Unhandled exception at 0x77d915de in test.exe: 0xC0000005: Access violation writing location 0x00000000.
我選擇調試,看看下面的堆棧:
ntdll.dll!77d915de() [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] ntdll.dll!77d915de() ntdll.dll!77d8014e() msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 504 + 0xc bytes C++ >ffffffff()
中斷調試在dbgheap.c __finally
線。堆棧已損壞,堆棧中缺少*p = 1
行。輸出窗口:
'test.exe': Loaded 'C:\tmp\test\Debug\test.exe', Symbols loaded. 'test.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file 'test.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file 'test.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file 'test.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded. First-chance exception at 0x010f13a8 in test.exe: 0xC0000005: Access violation writing location 0x00000000. Unhandled exception at 0x77d915de in test.exe: 0xC0000005: Access violation writing location 0x00000000.
現在,如果我在64 Debug配置運行同一程序,一切都OK了 - 上線*p = 1
中斷調試。我怎樣才能得到正確的調試Win32程序?
謝謝,這個伎倆。有趣的是,爲什麼它沒有對x64進行這種更改? –
可能通過設計,Visual Studio Debugger Team必須知道,[Connect for Site for Visual Studio](http://connect.microsoft.com/VisualStudio) – sergmat