你怎么看段错误内核日志消息 [英] How do you read a segfault kernel log message
问题描述
这是一个非常简单的问题,我在尝试调试产生在以下段错误错误应用程序中的 kern.log
This can be a very simple question, I'm am attempting to debug an application which generates the following segfault error in the kern.log
内核:的myapp [15514]:段错误的794ef0 IP 080513b SP 794ef0错误6的myapp [8048000 + 24000]
下面是我的问题:
-
是否有任何文件,以什么是对的段错误差异错误编号,在这种情况下它是错误6,但我看到的错误4,5
Is there any documentation as to what are the diff error numbers on segfault, in this instance it is error 6, but i've seen error 4, 5
什么是信息在bf794ef0 IP 0805130b SP bf794ef0和的myapp [8048000 + 24000]
?
到目前为止,我能够用符号来编译,当我做了 X 0x8048000 + 24000
它返回一个符号,就是这样做的正确方法是什么?我的假设迄今有以下几方面:
So far i was able to compile with symbols, and when i do a x 0x8048000+24000
it returns a symbol, is that the correct way of doing it? My assumptions thus far are the following:
- SP =堆栈指针?
- IP =指令指针
- 在= ????
- 的myapp [8048000 + 24000 =符号的地址?
推荐答案
根据我有限的知识,你的假设是正确的。
Based on my limited knowledge, your assumptions are correct.
-
SP
=堆栈指针 -
IP
=指令指针 -
的myapp [8048000 + 24000]
=地址
sp
= stack pointerip
= instruction pointermyapp[8048000+24000]
= address
如果我被调试的问题,我会修改code产生一个核心转储或日志一<一href=\"http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes/1925461#1925461\">stack就死机回溯。你也可以根据运行程序(或附加)GDB。
If I were debugging the problem I would modify the code to produce a core dump or log a stack backtrace on the crash. You might also run the program under (or attach) GDB.
错误code只是建筑的错误code为页面错误,似乎是体系结构相关的。他们往往在内核源代码记录在在arch / * / MM / fault.c
。我的的Linux /弓/ I386 / MM / fault.c
副本有错误_ code如下定义:
The error code is just the architectural error code for page faults and seems to be architecture specific. They are often documented in arch/*/mm/fault.c
in the kernel source. My copy of Linux/arch/i386/mm/fault.c
has the following definition for error_code:
- 位0 == 0表示没有找到页面,1表示保护故障
- 位1 == 0手段读出,1表示写
- 位2 == 0意味着内核,1意味着用户模式
我的的Linux /弓/ x86_64的/ MM / fault.c
的副本增加了以下内容:
My copy of Linux/arch/x86_64/mm/fault.c
adds the following:
- 3位== 1表示故障已取指令
这篇关于你怎么看段错误内核日志消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!