简体   繁体   English

在Visual Studio 2010 C ++中进行调试时出现奇怪的异常

[英]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.

相关问题 在Visual Studio 2010中调试C ++项目 - Debugging C++ project in Visual Studio 2010 调用CefBrowserHost :: CreateBrowser时Visual Studio C ++奇怪的异常 - Visual Studio C++ weird exception when calling CefBrowserHost::CreateBrowser 在Visual Studio 2010中调试由C ++程序调用的fortran dll - Debugging a fortran dll called by a C++ program in Visual Studio 2010 使用Visual Studio 2010调试C ++项目时出现问题 - Problem while Debugging a C++ project using Visual Studio 2010 引发Visual Studio C ++异常:读取访问冲突。 使用命令行参数进行调试时 - Visual Studio C++ Exception thrown: read access violation. When debugging using Command Line Argument C++ 和 Visual Studio 调试有没有办法在超出数组或内存分配范围时总是抛出异常? - Is there a way with C++ and visual studio debugging to always throw an exception when going outside of the bounds of an array or memory allocation? C++ 中的 const 过程,Visual Studio C++ 2010 中的奇怪错误? - Const procedure in C++, weird error in Visual Studio C++ 2010? Visual C ++ 2010调试问题 - visual c++ 2010 debugging problem 从Visual Studio 2015调试时找不到C ++文件 - C++ file not found when debugging from visual studio 2015 在Visual Studio 2013 for C ++中进行调试时的错误代码 - Error codes when debugging in Visual Studio 2013 for C++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM