objective-c – 在EXC_BAD_ACCESS中代码= 1和代码= 2之间有什么区别?
栏目: Objective-C · 发布时间: 7年前
内容简介:我正在为EXC_BAD_ACCESS错误接收代码= 1或代码= 2.我想知道代码= 1和代码= 2之间有什么区别?http://stackoverflow.com/questions/19741409/whats-the-difference-between-code-1-and-code-2-in-exc-bad-access
我正在为EXC_BAD_ACCESS错误接收代码= 1或代码= 2.我想知道代码= 1和代码= 2之间有什么区别?
代码= 1是KERN_INVALID_ADDRESS,代码= 2是KERN_PROTECTION_FAILURE.两者都是
在 “Technical Note TN2123 CrashReporter”年解释:
The most common forms of exception are:
-
EXC_BAD_ACCESS/KERN_INVALID_ADDRESS — This is caused by the thread
accessing unmapped memory. It may be triggered by either a data access
or an instruction fetch; the Thread State section describes how to
tell the difference. -
EXC_BAD_ACCESS/KERN_PROTECTION_FAILURE — This is
caused by the thread trying to write to read-only memory. This is
always caused by a data access.
代码定义在
<mach/kern_return.h>
:
#define KERN_INVALID_ADDRESS 1
/* Specified address is not currently valid.
*/
#define KERN_PROTECTION_FAILURE 2
/* Specified memory is valid, but does not permit the
* required forms of access.
*/
并在
<mach/exception_types.h>
中记录了代码
对于EXC_BAD_ACCESS是一个kern_return_t:
#define EXC_BAD_ACCESS 1 /* Could not access memory */
/* Code contains kern_return_t describing error. */
/* Subcode contains bad memory address. */
http://stackoverflow.com/questions/19741409/whats-the-difference-between-code-1-and-code-2-in-exc-bad-access
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Iterative Methods for Sparse Linear Systems, Second Edition
Yousef Saad / Society for Industrial and Applied Mathematics / 2003-04-30 / USD 102.00
Tremendous progress has been made in the scientific and engineering disciplines regarding the use of iterative methods for linear systems. The size and complexity of linear and nonlinear systems arisi......一起来看看 《Iterative Methods for Sparse Linear Systems, Second Edition》 这本书的介绍吧!