Gdb: cannot find new threads: general error after system update

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

Now my application can no longer be debugged (on the ARM board), every time I try to run it in gdb, I get the error message "gdb: Unable to find new threads: general error". The application uses pthreads and references pthreads (readelf lists libpthread.so.0 as a dependency). The suggested solutions that I have found so far recommend binding to pthread, which I already do. Another recommendation I found was to use LD_PRELOAD = / lib / libpthread.so.0 which does not make any difference to me.

Debugging x86 application builds works without problems.

EDIT: To answer the questions asked in the first answer, I use gdb for the target (ARM), i.e. there is no cross-gdb. I also did not share libpthread.so.0 (/lib/libpthread-2.9.so: 32-bit LSB file ELB, ARM, version 1 (SYSV), dynamically linked (uses shared libraries) for GNU / Linux 2.6. 16, not undresses). glibc remained in version 2.9, and the update included recompiling the entire Linux image

EDIT2: Removing / lib / libthread -db * allows debugging (with subsequent warnings and obviously some functions 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
+5
source share
1 answer

There are two common causes of this error:

  • You have the wrong match between libpthread.so.0andlibthread_db.so.1
  • You shared libpthread.so.0

Your message is not entirely clear:

  • Cross GDB , ARM x86?
  • ( ) glibc ..

libpthread.so.0, - libthread_db , .

-, libthread_db.so.1 , glibc.

Update:


libpthread

, - GDB glibc, , . ,

  • libthread_db
  • (gdb) set debug libthread-db 1
  • (gdb) run

2:

: :

, GDB td_ta_set_event libthread_db , . , GDB __nptl_threads_events libpthread.so.0. :

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

, :

000000000021c294 b __nptl_threads_events

, . , GDB, , .

, , grep , toolchain: , libpthread.so.0.

+6

All Articles