本文介绍了什么是SEGV_MAPERR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是SEGV_MAPERR
,为什么总是出现SIGSEGV
?
What is SEGV_MAPERR
, why does it always come up with SIGSEGV
?
推荐答案
SEGV ,这是由于无效的内存访问导致的错误:
There are two common kinds of SEGV, which is an error that results from an invalid memory access:
- 访问了具有错误权限的页面.例如,它是只读的,但是您的代码尝试写入它.这将报告为 SEGV_ACCERR .
- 所访问的页面甚至根本没有映射到应用程序的地址空间.这通常是由于取消引用空指针或使用小整数值损坏的指针而导致的.据报道为 SEGV_MAPERR .
- A page was accessed which had the wrong permissions. E.g., it was read-only but your code tried to write to it. This will be reported as SEGV_ACCERR.
- A page was accessed that is not even mapped into the address space of the application at all. This will often result from dereferencing a null pointer or a pointer that was corrupted with a small integer value. This is reported as SEGV_MAPERR.
有关SEGV_MAPERR的某种文档(带索引的Linux源代码)在这里: http://lxr.free-electrons.com/ident?i=SEGV_MAPERR .
Documentation of a sort (indexed Linux source code) for SEGV_MAPERR is here: http://lxr.free-electrons.com/ident?i=SEGV_MAPERR.
这篇关于什么是SEGV_MAPERR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!