[英]What does the error “Segmentation fault(core dumped)” mean?
i am trying to implement a for-loop using assembler coding and in each iteration the value of the register edi should be printed.我正在尝试使用汇编程序编码实现一个 for 循环,并且在每次迭代中都应该打印寄存器 edi 的值。 When I try to execute my code, I get an Error "Segmentation fault(core dumped)".
当我尝试执行我的代码时,我收到错误“分段错误(核心转储)”。 Can somebody please tell me what does this error mean and are there any mistakes in my code?
有人可以告诉我这个错误是什么意思,我的代码中是否有任何错误?
section .text
global _start
_start:
xor edi,edi
loop:
add edi,'0'
;print i
mov edi,1
mov esi,1
mov ecx,[edi]
mov edx,1
syscall
sub edi,'0'
inc edi
cmp edi,5
jl loop
It means that you attempted to access address space in a way that's not permitted.这意味着您试图以不允许的方式访问地址空间。 For example:
例如:
you might have tried to write to a read only location您可能已尝试写入只读位置
you might have tried to read from a write only location您可能曾尝试从只写位置读取
you might have tried to execute code from a location without execute permissions set您可能曾尝试从未设置执行权限的位置执行代码
you might have tried to read or write from an address either not mapped at all, or mapped with all kinds of access disallowed您可能试图从根本没有映射的地址读取或写入,或者映射了不允许的各种访问
And there are a few more conditions that cause this signal to trip.还有其他一些条件会导致此信号跳闸。 Have a look at the man pages of
mmap
and mprotect
to get an idea of what's possible.查看
mmap
和mprotect
的手册页以了解可能的情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.