在Linux上的核心转储中找到崩溃的汇编指令 [英] Find the crashing assembly instruction from core dump on Linux
本文介绍了在Linux上的核心转储中找到崩溃的汇编指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我将崩溃的程序和核心转储加载到 gdb
中,它将显示堆栈跟踪和崩溃点,如下所示.
If I load the crashing program and the core dump into gdb
, it shows me a stack trace and crash point as below.
Core was generated by `./cut --output-d=: -b1,1234567890- /dev/fd/63'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 is_printable_field (i=1234567890) at src/cut.c:266
266 return (printable_field[n] >> (i % CHAR_BIT)) & 1;
(gdb) bt
#0 is_printable_field (i=1234567890) at src/cut.c:266
#1 set_fields (fieldstr=0x7ffccb0561c4 "") at src/cut.c:533
#2 main (argc=4, argv=0x7ffccb055cf8) at src/cut.c:865
有什么方法可以知道导致段错误的确切汇编指令吗?
Is there any means to know the exact assembly instruction that caused the segfault?
推荐答案
一种可能性是设置:
(gdb)layout asm
当 GDB 停止时,指向相应的流水线.
When GDB stops the corresponding assembly line is pointed.
示例:
│0x7ffff7aa441d <strtok+45> je 0x7ffff7aa44d6 <strtok+230> │
│0x7ffff7aa4423 <strtok+51> mov %rsi,%rax │
>│0x7ffff7aa4426 <strtok+54> mov (%rax),%cl │
│0x7ffff7aa4428 <strtok+56> test %cl,%cl │
│0x7ffff7aa442a <strtok+58> je 0x7ffff7aa4454 <strtok+100>
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7aa4426 in strtok () from /lib64/libc.so.6
(gdb)
这篇关于在Linux上的核心转储中找到崩溃的汇编指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文