Unable to find libthread_db matching inferior‘s thread library, thread debugging will not be availab

在尝试使用GDB进行程序调试时遇到了问题,包括无法找到libthread_db库导致线程调试不可用,以及警告提示无法确定硬件断点数量。解决方法是编辑配置文件'/root/.gdbinit',添加'add-auto-load-safe-path/lib64/libthread_db-1.0.so'行,并考虑在编译时添加'-g'选项以启用调试模式。
摘要由CSDN通过智能技术生成

开启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.

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值