解释段错误消息 [英] Interpreting segfault messages

查看:122
本文介绍了解释段错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下段错误消息的正确解释是什么?

What is the correct interpretation of the following segfault messages?

segfault at 10 ip 00007f9bebcca90d sp 00007fffb62705f0 error 4 in libQtWebKit.so.4.5.2[7f9beb83a000+f6f000]
segfault at 10 ip 00007fa44d78890d sp 00007fff43f6b720 error 4 in libQtWebKit.so.4.5.2[7fa44d2f8000+f6f000]
segfault at 11 ip 00007f2b0022acee sp 00007fff368ea610 error 4 in libQtWebKit.so.4.5.2[7f2aff9f7000+f6f000]
segfault at 11 ip 00007f24b21adcee sp 00007fff7379ded0 error 4 in libQtWebKit.so.4.5.2[7f24b197a000+f6f000]

推荐答案

这是一个段错误,原因是跟随空指针试图查找要运行的代码(即在指令提取期间).

This is a segfault due to following a null pointer trying to find code to run (that is, during an instruction fetch).

运行addr2line -e yourSegfaultingProgram 00007f9bebcca90d(并重复给定的其他指令指针值)以查看发生错误的位置.更好的是,获得一个带有调试工具的内部版本,并在诸如gdb的调试器下重现该问题.

Run addr2line -e yourSegfaultingProgram 00007f9bebcca90d (and repeat for the other instruction pointer values given) to see where the error is happening. Better, get a debug-instrumented build, and reproduce the problem under a debugger such as gdb.

不幸的是,您被水淹了;事后无法知道动态链接程序将库放置在内存中的位置.重现gdb下的问题.

You're hosed, unfortunately; it's not possible to know where the libraries were placed in memory by the dynamic linker after-the-fact. Reproduce the problem under gdb.

以下是字段的细分:

  • address(在at之后)-代码尝试访问的内存位置(1011可能是我们希望将其设置为有效值的指针的偏移量,但是而是指向0)
  • ip-指令指针,即尝试执行此操作的代码在哪里
  • sp-堆栈指针
  • error-页面错误的错误代码;有关在x86上的含义,请参见下文.

  • address (after the at) - the location in memory the code is trying to access (it's likely that 10 and 11 are offsets from a pointer we expect to be set to a valid value but which is instead pointing to 0)
  • ip - instruction pointer, ie. where the code which is trying to do this lives
  • sp - stack pointer
  • error - An error code for page faults; see below for what this means on x86.

/*
 * Page fault error code bits:
 *
 *   bit 0 ==    0: no page found       1: protection fault
 *   bit 1 ==    0: read access         1: write access
 *   bit 2 ==    0: kernel-mode access  1: user-mode access
 *   bit 3 ==                           1: use of reserved bit detected
 *   bit 4 ==                           1: fault was an instruction fetch
 */

这篇关于解释段错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆