[英]Weird exception when debugging in visual studio 2010 c++
I am experiencing this error when I try to debug my program. 尝试调试程序时遇到此错误。 it seems that it cannot even take in the argument I pass to main function:
似乎它甚至不能接受我传递给main函数的参数:
int main(int argc, char* argv[]){
if(argc!=4) std::cout<<wrong input";
else{
//other codes
}
return 0;
}
I put my breakpoint on the first line (main function line) and it gives me the following error: 我将断点放在第一行(主功能行)上,它给了我以下错误:
'MESH.exe': Loaded 'C:\Users\Avan\Documents\NUS\Yr3_Sem2\CS3242\MESH\Debug\MESH.exe', Symbols loaded.
'MESH.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Symbols loaded (source information stripped).
'MESH.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Symbols loaded (source information stripped).
'MESH.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Symbols loaded (source information stripped).
'MESH.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded (source information stripped).
'MESH.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded (source information stripped).
First-chance exception at 0x00318c67 in MESH.exe: 0xC00000FD: Stack overflow.
Unhandled exception at 0x00318c67 in MESH.exe: 0xC00000FD: Stack overflow.
First-chance exception at 0x00318c67 in MESH.exe: 0xC0000005: Access violation reading location 0x003a0000.
Unhandled exception at 0x00318c67 in MESH.exe: 0xC0000005: Access violation reading location 0x003a0000.
The program '[4800] MESH.exe: Native' has exited with code -1073741819 (0xc0000005).
So I presume the error comes from when I passing down the input. 因此,我认为错误是由于我向下传递输入时产生的。 I have set the command line input argument in the project->properties->debugging
我已经在project-> properties-> debugging中设置了命令行输入参数
the error keep pointing to a chkstk.asm file which I have no idea what is it. 该错误不断指向chkstk.asm文件,我不知道它是什么。
; Find next lower page and probe
cs20:
sub eax, _PAGESIZE_ ; decrease by PAGESIZE
**test dword ptr [eax],eax ; probe page.**
jmp short cs10
_chkstk endp
end
The pointer keep pointing to the line indicated above with the **. 指针继续指向上面用**指示的行。 Can anyone tell me what could have gone wrong?
谁能告诉我可能出了什么问题?
Well, given it's complaining about a stack overflow, the first thing I'd be looking at is if you're trying to allocate a lot of stuff on the stack. 好吧,鉴于它在抱怨一个堆栈溢出,我会看的第一件事是,如果你想分配了很多的东西在堆栈上。
For example, if your //other codes
contains something like: 例如,如果您的
//other codes
包含类似以下内容的//other codes
:
int bigarray[9999999999];
then that would be a likely culprit. 那可能是罪魁祸首。
I wouldn't be too worried about the fact that the error is coming from chkstk.asm
, that's almost certainly some defensive code which is checking to see if you've blown out the stack (hence chkstk
for check stack
) and generating the first-chance exception. 我不会太担心错误来自
chkstk.asm
,这几乎肯定是一些防御性代码,用于检查您是否耗尽了堆栈(因此chkstk
用于check stack
)并生成第一个-机会异常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.