gdb:找不到新线程:系统更新后出现一般错误 [英] gdb: Cannot find new threads: generic error after system update

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

问题描述

我在运行我的应用程序的 ARM 板上运行基于 OpenEmbedded 的 Linux.我曾经运行过内核 2.6.35、gdb 6.8 和 gcc 4.3.最近我将系统更新到内核 2.6.37、gdb 7.4(也尝试了 7.3)和 gcc 4.6.

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.

现在,我的应用程序无法再调试(在 ARM 板上),每次我尝试在 gdb 中运行它时,我都会收到错误gdb:找不到新线程:通用错误".该应用程序使用 pthreads 并链接 pthreads(readelf 将 libpthread.so.0 列为依赖项).到目前为止,我发现的建议解决方案都建议链接到我已经在做的 pthread.我发现的另一个建议是使用 LD_PRELOAD=/lib/libpthread.so.0,这对我没有任何影响.

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.

调试应用程序的 x86 构建没有问题.

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

为了回答第一个答案中提出的问题,我在目标 (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 镜像

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

删除/lib/libthread-db* 允许调试(随之而来的警告和显然某些功能将不起作用)

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

使用 set debug libthread-db 1 我得到:

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. libpthread.so.0libthread_db.so.1
  2. 不匹配
  3. 你已经剥离了 libpthread.so.0

您的信息不完全清楚:

  1. 您是否使用跨 GDB 从 x86 主机调试在 ARM 上运行的应用程序?
  2. 除了更新内核等之外,您是否还更新(或重建)了 glibc.

如果你去掉了libpthread.so.0,那么不要那样做——libthread_db不需要 被剥离.

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

如果您正在交叉调试,请确保在主机上重建 libthread_db.so.1 以匹配目标上的 glibc.

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

更新:

不交叉调试
没有剥离 libpthread

not cross-debugging
did not strip libpthread

因此,您的 GDB 或 glibc 中的某些内容似乎已损坏.你可以试试看是什么

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

  1. 将移除的 libthread_db 放回原处,并且
  2. (gdb) 设置调试 libthread-db 1
  3. (gdb) 运行
  1. Putting removed libthread_db back, and
  2. (gdb) set debug libthread-db 1
  3. (gdb) run

更新 2:

警告:无法设置全局线程事件掩码:通用错误

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

这意味着 GDB 能够在 libthread_db 中查找 td_ta_set_event 函数,并调用它,但该函数返回错误.发生这种情况的一种方式是 GDB 无法在 libpthread.so.0 中找到 __nptl_threads_events 函数.这个命令产生什么:

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

那么我不确定还有什么失败了.您可能需要调试 GDB 本身才能弄清楚发生了什么.

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

另一方面,如果上面的 grep 没有产生任何输出,那么这是您的工具链的问题:您必须弄清楚为什么该变量没有出现在您重建的 中libpthread.so.0.

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天全站免登陆