Home  >  Article  >  Database  >  catch access violation exception

catch access violation exception

WBOY
WBOYOriginal
2016-06-07 15:42:391376browse

catch access violation exception 遇到一个蛋疼的程序崩溃问题,debug模式下程序直接卡死,minidump可以定位到出错的代码,但捕捉到的数据太少,无法确定什么位置引起的内存访问错误。如果可以捕捉到这个异常设置断点,调试起来会方便很多。由于access viol

 catch access violation exception

 

     遇到一个蛋疼的程序崩溃问题,debug模式下程序直接卡死,minidump可以定位到出错的代码,但捕捉到的数据太少,无法确定什么位置引起的内存访问错误。如果可以捕捉到这个异常设置断点,调试起来会方便很多。由于access violation exception是ms定义的异常类型,普通编译方式下try{} catch(...){}无法捕获到此异常。Google了一下,有几种方式可以捕获到ave,最简单的就是修改编译属性:Project Properties -> C/C++ -> Code Generation -> Modify the Enable C++ Exceptions to "Yes With SEH". 这样catch(...){}就可以正确捕获到vae了:)   此法最好只在调试时使用,正常发布的因此应该坚持使用默认编译属性,同时避免catch vae错误.

 

 

 

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn