在linux下安装GDB

(1)首选要解决命令debuginfo-install不可用的问题

 

vi /etc/yum.repos.d/CentOS-Debuginfo.repo

将enabled修改为1

 

yum install nss-softokn-debuginfo

 

yum install yum-utils

 

debuginfo-install glibc

 

(2)然后安装GDB

yum install gdb

 

于是就可以用GDB调试程序了

Program received signal SIGSEGV, Segmentation fault.

0x00007ffff7a9fc50 in _IO_vfscanf_internal (s=<value optimized out>, format=0x400b00 “”, argptr=0x7fffffffe4a0, errp=0x0) at vfscanf.c:1772

1772                        *ARG (unsigned int *) = (unsigned int) num.ul;

(gdb) b

Breakpoint 1 at 0x7ffff7a9fc50: file vfscanf.c, line 1772.