objdump segfault
#include<stdio.h> #include<stdlib.h> void main() { int *ptr = (int *)0; *ptr = 100; }
root@ubuntu:~/c++# gcc seg.c -o seg root@ubuntu:~/c++# ./seg Segmentation fault (core dumped) root@ubuntu:~/c++# dmesg | tail [21055026.085064] docker0: port 3(veth7dedaac) entered disabled state [21055026.109850] device veth7dedaac left promiscuous mode [21055026.109858] docker0: port 3(veth7dedaac) entered disabled state [21055046.474219] docker0: port 3(vetha7993f7) entered blocking state [21055046.474223] docker0: port 3(vetha7993f7) entered disabled state [21055046.474331] device vetha7993f7 entered promiscuous mode [21055046.863355] eth0: renamed from veth409855b [21055046.887505] IPv6: ADDRCONF(NETDEV_CHANGE): vetha7993f7: link becomes ready [21055046.888059] docker0: port 3(vetha7993f7) entered blocking state [21055046.888063] docker0: port 3(vetha7993f7) entered forwarding state root@ubuntu:~/c++# dmesg | grep segfault root@ubuntu:~/c++# objdump -d ./seg > segDump root@ubuntu:~/c++# dmesg | tail -n1 [21055046.888063] docker0: port 3(vetha7993f7) entered forwarding state root@ubuntu:~/c++# dmesg | grep seg
dmesg没有消息
root@ubuntu:~/c++# catchsegv ./seg Segmentation fault (core dumped) *** Segmentation fault Backtrace: /lib/aarch64-linux-gnu/libSegFault.so(+0x136c)[0xffff92f0736c] Memory map: aaaad4dc4000-aaaad4dc5000 r-xp 00000000 08:23 6321742 /root/c++/seg aaaad4dd4000-aaaad4dd5000 r--p 00000000 08:23 6321742 /root/c++/seg aaaad4dd5000-aaaad4dd6000 rw-p 00001000 08:23 6321742 /root/c++/seg aaaaf0c54000-aaaaf0c75000 rw-p 00000000 00:00 0 [heap] ffff92d77000-ffff92d8a000 r-xp 00000000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffff92d8a000-ffff92d99000 ---p 00013000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffff92d99000-ffff92d9a000 r--p 00012000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffff92d9a000-ffff92d9b000 rw-p 00013000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffff92d9b000-ffff92eda000 r-xp 00000000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffff92eda000-ffff92eea000 ---p 0013f000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffff92eea000-ffff92eee000 r--p 0013f000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffff92eee000-ffff92ef0000 rw-p 00143000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffff92ef0000-ffff92ef4000 rw-p 00000000 00:00 0 ffff92f06000-ffff92f08000 r-xp 00000000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffff92f08000-ffff92f17000 ---p 00002000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffff92f17000-ffff92f18000 r--p 00001000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffff92f18000-ffff92f19000 rw-p 00002000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffff92f19000-ffff92f36000 r-xp 00000000 08:23 7077982 /lib/aarch64-linux-gnu/ld-2.27.so ffff92f40000-ffff92f44000 rw-p 00000000 00:00 0 ffff92f44000-ffff92f45000 r--p 00000000 00:00 0 [vvar] ffff92f45000-ffff92f46000 r-xp 00000000 00:00 0 [vdso] ffff92f46000-ffff92f47000 r--p 0001d000 08:23 7077982 /lib/aarch64-linux-gnu/ld-2.27.so ffff92f47000-ffff92f49000 rw-p 0001e000 08:23 7077982 /lib/aarch64-linux-gnu/ld-2.27.so ffffcb894000-ffffcb8b5000 rw-p 00000000 00:00 0 [stack] root@ubuntu:~/c++#
-g 选项
root@ubuntu:~/c++# gcc -g seg.c -o seg root@ubuntu:~/c++# catchsegv ./seg Segmentation fault (core dumped) *** Segmentation fault Backtrace: /lib/aarch64-linux-gnu/libSegFault.so(+0x136c)[0xffffadbad36c] Memory map: aaaae7a4a000-aaaae7a4b000 r-xp 00000000 08:23 6321742 /root/c++/seg aaaae7a5a000-aaaae7a5b000 r--p 00000000 08:23 6321742 /root/c++/seg aaaae7a5b000-aaaae7a5c000 rw-p 00001000 08:23 6321742 /root/c++/seg aaaafdd26000-aaaafdd47000 rw-p 00000000 00:00 0 [heap] ffffada1d000-ffffada30000 r-xp 00000000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffffada30000-ffffada3f000 ---p 00013000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffffada3f000-ffffada40000 r--p 00012000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffffada40000-ffffada41000 rw-p 00013000 08:23 7083146 /lib/aarch64-linux-gnu/libgcc_s.so.1 ffffada41000-ffffadb80000 r-xp 00000000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffffadb80000-ffffadb90000 ---p 0013f000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffffadb90000-ffffadb94000 r--p 0013f000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffffadb94000-ffffadb96000 rw-p 00143000 08:23 7077987 /lib/aarch64-linux-gnu/libc-2.27.so ffffadb96000-ffffadb9a000 rw-p 00000000 00:00 0 ffffadbac000-ffffadbae000 r-xp 00000000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffffadbae000-ffffadbbd000 ---p 00002000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffffadbbd000-ffffadbbe000 r--p 00001000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffffadbbe000-ffffadbbf000 rw-p 00002000 08:23 7077985 /lib/aarch64-linux-gnu/libSegFault.so ffffadbbf000-ffffadbdc000 r-xp 00000000 08:23 7077982 /lib/aarch64-linux-gnu/ld-2.27.so ffffadbe6000-ffffadbea000 rw-p 00000000 00:00 0 ffffadbea000-ffffadbeb000 r--p 00000000 00:00 0 [vvar] ffffadbeb000-ffffadbec000 r-xp 00000000 00:00 0 [vdso] ffffadbec000-ffffadbed000 r--p 0001d000 08:23 7077982 /lib/aarch64-linux-gnu/ld-2.27.so ffffadbed000-ffffadbef000 rw-p 0001e000 08:23 7077982 /lib/aarch64-linux-gnu/ld-2.27.so ffffcee91000-ffffceeb2000 rw-p 00000000 00:00 0 [stack]