[work@VM_50_226_centos ~]$ gdb ./main GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from ./main...(no debugging symbols found)...done.
(gdb) b main Breakpoint 1 at 0x450884
(gdb) r
Starting program: ./main [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, 0x0000000000450884 in main () Missing separate debuginfos, use: debuginfo-install glibc-2.17-196.tl2.3.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.13.2-10.el7.x86_64 libcom_err-1.42.9-7.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libselinux-2.2.2-6.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 mariadb-libs-5.5.50-1.el7_2.x86_64 openssl-libs-1.0.2k-16.tl2.2.x86_64 pcre-8.32-15.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) list 1 /usr/src/packages/BUILD/glibc-2.4/cc-nptl/csu/crti.S: 没有那个文件或目录.
if you make with cmake, you can type ADD_DEFINITIONS("-Wall -g") in your cmakelists.txt. or if you make with gcc/g++, you can specify -g option when you run your gcc/g++ command.