How do you read a segfault kernel log message

前端 未结 3 1689
野趣味
野趣味 2020-12-12 10:16

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

kernel

3条回答
  •  一个人的身影
    2020-12-12 10:53

    When the report points to a program, not a shared library

    Run addr2line -e myapp 080513b (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.

    If it's a shared library

    In the libfoo.so[NNNNNN+YYYY] part, the NNNNNN is where the library was loaded. Subtract this from the instruction pointer (ip) and you'll get the offset into the .so of the offending instruction. Then you can use objdump -DCgl libfoo.so and search for the instruction at that offset. You should easily be able to figure out which function it is from the asm labels. If the .so doesn't have optimizations you can also try using addr2line -e libfoo.so .

    What the error means

    Here's the breakdown of the fields:

    • address - 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 - Architecture-specific flags; see arch/*/mm/fault.c for your platform.

提交回复
热议问题