objective-c – 在EXC_BAD_ACCESS中代码= 1和代码= 2之间有什么区别?
栏目: Objective-C · 发布时间: 6年前
内容简介:我正在为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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 《JavaScript DOM编程艺术》作者谈:原型代码与生产代码之间的矛盾
- C和Lua之间的相互调用-代码例子2
- Angular 允许开发者在 Web 和移动应用之间共享代码
- Angular 允许开发者在 Web 和移动应用之间共享代码
- Android 开发中的代码片段(2)复制对象之间的属性值
- Firefox Beta加速了JavaScript和WebAssembly之间的代码调用
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Design systems
Not all design systems are equally effective. Some can generate coherent user experiences, others produce confusing patchwork designs. Some inspire teams to contribute to them, others are neglected. S......一起来看看 《Design systems》 这本书的介绍吧!