开启gdb调试出现以下问题
1.Unable to find libthread_db matching inferior’s thread library, thread debugging will not be available.
(gdb) start
Temporary breakpoint 1 at 0x4d1ab4: file /xxx/xxx.c, line 1099.
Starting program: /xxx
warning: Unable to determine the number of hardware watchpoints available.
warning: Unable to determine the number of hardware breakpoints available.
warning: File "/lib64/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /lib64/libthread_db-1.0.so
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
根据它的提示添加配置文件"/root/.gdbinit"
文件内容"add-auto-load-safe-path /lib64/libthread_db-1.0.so"
2.Make breakpoint pending on future shared library load? (y or [n])
Make breakpoint pending on future shared library load? (y or [n])
大概率是程序没有开启调试模式,编译的时候加个 条件 -g.