GDB:无法找到新主题:系统更新后一般错误 [英] gdb: Cannot find new threads: generic error after system update

查看:1477
本文介绍了GDB:无法找到新主题:系统更新后一般错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ARM板,在我的应用程序正在运行运行基于Linux的OpenEmbedded的。我用来运行内核2.6.35,GDB 6.8和GCC 4.3。最近我已经更新了系统内核2.6.37,GDB 7.4(也试过7.3)和gcc 4.6。

现在,我的应用程序无法再调试(在ARM板),每次我尝试在GDB运行它,我得到错误GDB:无法找到新主题:一般错误。该应用程序使用的pthreads的,而且能依靠pthreads链接(readelf列表libpthread.so.0作为一个依赖)。建议的解决方案,我发现到目前为止,所有推荐链接PTHREAD这我已经做的事情。我发现的另一项建议是使用LD_ preLOAD = / lib中/ libpthread.so.0不作任何区别我。

调试的x86生成应用程序的作品没有问题。

编辑:要回答的第一个答案提出的问题,我使用的目标(ARM)GDB,即无交叉GDB。我也没有剥夺libpthread.so.0(/lib/libpthread-2.9.so:ELF 32位LSB的共享对象,ARM版本1(SYSV),动态链接(使用共享库),为GNU / Linux 2.6。 16,不要剥去)。 glibc的保持在2.9版本和更新涉及重新编译整个Linux映像

EDIT2:删除/ lib中/的libthread-DB *允许调试(与随之而来的警告和显然有些功能将无法正常工作)

EDIT3:使用组调试的libthread-DB 1我得到:

 启动程序:/家庭/根/应用
试图主机libthread_db所图书馆:的libthread_db.so.1。
主机的libthread_db.so.1决定:/lib/libthread_db.so.1。
td_ta_new失败:应用程序不与相连的libthread
thread_db_load_search返回0
试图主机libthread_db所图书馆:的libthread_db.so.1。
主机的libthread_db.so.1决定:/lib/libthread_db.so.1。
[使用线程调试libthread_db所启用]
使用主机libthread_db所图书馆/lib/libthread_db.so.1。
警告:无法设置全局线程事件掩码:一般错误
警告:find_new_threads_once:find_new_threads_callback:不能让线程信息:常规错误
在迭代0 0找到新主题。
警告:find_new_threads_once:find_new_threads_callback:不能让线程信息:常规错误
在迭代1 0找到新主题。
警告:find_new_threads_once:find_new_threads_callback:不能让线程信息:常规错误
在迭代2 0找到新主题。
警告:find_new_threads_once:find_new_threads_callback:不能让线程信息:常规错误
在迭代3 0找到新主题。
thread_db_load_search返回1
警告:find_new_threads_once:find_new_threads_callback:不能让线程信息:常规错误
在迭代0 0找到新主题。
无法找到新主题:一般性错误
(GDB)收件失败:断的管


解决方案

有此错误的两个常见的原因:


  1. 您有 libpthread.so.0 的libthread_db.so.1
  2. 您已经剥离 libpthread.so.0

您的信息是不完全清楚:


  1. 您使用的交叉GDB调试从在x86主机上的ARM运行的应用程序?

  2. 你除了更新内核,更新等(或重建)的glibc

如果你剥夺 libpthread.so.0 ,然后的不这样做的 - libthread_db所它需要的的剥离。

如果你是跨调试,确保重建的libthread_db.so.1 主机匹配的glibc 目标。

更新:


  

不交叉调试结果
  没有剥离的libpthread


所以,一些在你的GDB或的glibc 似乎已被打破。您可以尝试一看就知道是

什么

  1. 把删除 libthread_db所后面,

  2. (GDB)设置调试的libthread-DB 1

  3. (GDB)运行

更新2:


  

警告:无法设置全局线程事件掩码:一般性错误


这意味着,GDB能够查找 td_ta_set_event 功能libthread_db所,并把它称为,但该函数返回一个错误。这可能发生的一种方法是,如果GDB无法找到 libpthread.so.0 __ nptl_threads_events 功能。这是什么命令产生:

 纳米/lib/libpthread.so.0 | grep的__nptl_threads_events

如果该命令产生输出,例如:

  000000000021c294 b __nptl_threads_events

然后我不知道还有什么失败。你可能必须GDB调试自己弄清楚发生了什么。

如果在另一方面,的grep 上面不产生输出,那么它与你的工具链一个问题:你必须弄清楚为什么这个变量不会出现在重建 libpthread.so.0

I am running an OpenEmbedded based Linux on an ARM board, where my application is running. I used to run kernel 2.6.35, gdb 6.8 and gcc 4.3. Lately I've updated the system to kernel 2.6.37, gdb 7.4 (also tried 7.3) and gcc 4.6.

Now, my application can not be debugged anymore (on the ARM board), everytime I try to run it in gdb I get the error "gdb: Cannot find new threads: generic error". The application makes use of pthreads and does link against pthreads (readelf lists libpthread.so.0 as a dependency). The suggested solutions I found so far all recommend linking to pthread which I am already doing. The other recommendation I found was to use LD_PRELOAD=/lib/libpthread.so.0 which does not make any difference for me.

Debugging the x86 builds of the application works without a problem.

EDIT: To answer the questions posed in the first answer, I am using gdb on the target (ARM), i.e. no cross-gdb. I also have not stripped libpthread.so.0 (/lib/libpthread-2.9.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped). glibc remained at version 2.9, and the update involved recompiling the whole linux image

EDIT2: Removing /lib/libthread-db* allows debugging (with consequent warnings and obviously some features will not work)

EDIT3: Using set debug libthread-db 1 I get:

Starting program: /home/root/app
Trying host libthread_db library: libthread_db.so.1.
Host libthread_db.so.1 resolved to: /lib/libthread_db.so.1.
td_ta_new failed: application not linked with libthread
thread_db_load_search returning 0
Trying host libthread_db library: libthread_db.so.1.
Host libthread_db.so.1 resolved to: /lib/libthread_db.so.1.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
warning: Unable to set global thread event mask: generic error
Warning: find_new_threads_once: find_new_threads_callback: cannot get thread info: generic error
Found 0 new threads in iteration 0.
Warning: find_new_threads_once: find_new_threads_callback: cannot get thread info: generic error
Found 0 new threads in iteration 1.
Warning: find_new_threads_once: find_new_threads_callback: cannot get thread info: generic error
Found 0 new threads in iteration 2.
Warning: find_new_threads_once: find_new_threads_callback: cannot get thread info: generic error
Found 0 new threads in iteration 3.
thread_db_load_search returning 1
Warning: find_new_threads_once: find_new_threads_callback: cannot get thread info: generic error
Found 0 new threads in iteration 0.
Cannot find new threads: generic error
(gdb) Write failed: Broken pipe

解决方案

There are two common causes of this error:

  1. You have a mis-match between libpthread.so.0 and libthread_db.so.1
  2. You have stripped libpthread.so.0

Your message isn't entirely clear:

  1. are you using cross GDB to debug the application running on ARM from an x86 host?
  2. have you updated (or rebuilt) glibc in addition to updating the kernel, etc.

If you stripped libpthread.so.0, then don't do that -- libthread_db needs it to not be stripped.

If you are cross-debugging, make sure to rebuild libthread_db.so.1 on host to match glibc on target.

Update:

not cross-debugging
did not strip libpthread

So, something in your GDB or glibc appears to have been broken. You can try to see what that is by

  1. Putting removed libthread_db back, and
  2. (gdb) set debug libthread-db 1
  3. (gdb) run

Update 2:

warning: Unable to set global thread event mask: generic error

This means that GDB was able to look up td_ta_set_event function in libthread_db, and called it, but the function returned an error. One way this could happen is if GDB was unable to find __nptl_threads_events function in libpthread.so.0. What does this command produce:

nm /lib/libpthread.so.0 | grep __nptl_threads_events

If that command produces output, e.g.:

000000000021c294 b __nptl_threads_events

then I am not sure what else is failing. You'll likely have to debug GDB itself to figure out what's happening.

If on the other hand the grep above produces no output, then it's a problem with your toolchain: you'll have to figure out why that variable doesn't appear in your rebuilt libpthread.so.0.

这篇关于GDB:无法找到新主题:系统更新后一般错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆