http://sourceware.org/ml/gdb-patches/2011-02/msg00675.html Subject: [patch 3/3] Display core reasons even during thread error [ rediff ] Hi, this is mostly unrelated. But after the patch 2/3 it will still FAIL: Loaded symbols for /lib64/ld-linux-x86-64.so.2 Cannot find new threads: debugger service failed (gdb) FAIL: gdb.threads/gcore-thread.exp: re-load generated corefile as it is a common bug I dislike for years I have fixed it here: Loaded symbols for /lib64/ld-linux-x86-64.so.2 Cannot find new threads: debugger service failed Core was generated by `.../gdb/testsuite/gdb.threads/gcore-thread'. Program terminated with signal 5, Trace/breakpoint trap. #0 thread2 (arg=0xdeadbeef) at ./gdb.threads/pthreads.c:91 91 int k = 0; (gdb) PASS: gdb.threads/gcore-thread.exp: re-load generated corefile No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu. Thanks, Jan gdb/ 2011-02-24 Jan Kratochvil * corelow.c: Include wrapper.h. (core_open): Call now gdb_target_find_new_threads. * wrapper.c: Include target.h. (gdb_target_find_new_threads): New. * wrapper.h (gdb_target_find_new_threads): New declaration. --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -47,6 +47,7 @@ #include "auxv.h" #include "elf/common.h" #include "gdbcmd.h" +#include "wrapper.h" #ifndef O_LARGEFILE @@ -428,7 +429,7 @@ core_open (char *filename, int from_tty) may be a thread_stratum target loaded on top of target core by now. The layer above should claim threads found in the BFD sections. */ - target_find_new_threads (); + gdb_target_find_new_threads (); p = bfd_core_file_failing_command (core_bfd); if (p) --- a/gdb/wrapper.c +++ b/gdb/wrapper.c @@ -21,6 +21,7 @@ #include "exceptions.h" #include "wrapper.h" #include "ui-out.h" +#include "target.h" int gdb_parse_exp_1 (char **stringptr, struct block *block, int comma, @@ -161,3 +162,24 @@ gdb_value_struct_elt (struct ui_out *uiout, struct value **result, return GDB_RC_FAIL; return GDB_RC_OK; } + +/* Call target_find_new_threads without throwing exception. Exception is + printed if it got thrown. */ + +int +gdb_target_find_new_threads (void) +{ + volatile struct gdb_exception except; + + TRY_CATCH (except, RETURN_MASK_ERROR) + { + target_find_new_threads (); + } + + if (except.reason < 0) + { + exception_print (gdb_stderr, except); + return 0; + } + return 1; +} --- a/gdb/wrapper.h +++ b/gdb/wrapper.h @@ -48,4 +48,6 @@ extern int gdb_value_ind (struct value *val, struct value ** rval); extern int gdb_parse_and_eval_type (char *, int, struct type **); +extern int gdb_target_find_new_threads (void); + #endif /* wrapper.h */