[RFA] Don't use thread_db on corefiles

Daniel Jacobowitz
2001-12-13T16:50:03Z

This patch fixes a really frustrating internal error when you open the
coredump of a multithreaded application. Depending on your kernel, either
the core has threads (corefile.c supports this just fine) or it doesn't.
Neither way will opening libthread_db work right.

This patch isn't quite complete, because strange things happen when you
connect to a remote target too. But fixing that requires a little more
fiddling.

Is this OK?

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2001-12-13 Daniel Jacobowitz <drow@mvista.com>

* thread-db.c (thread_db_new_objfile): Don't use thread_db on
corefiles.

Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/thread-db.c,v
retrieving revision 1.18
diff -u -r1.18 thread-db.c
--- thread-db.c 2001/10/13 15:04:02 1.18
+++ thread-db.c 2001/12/13 16:43:08
@@ -482,7 +482,9 @@
{
td_err_e err;

- if (objfile == NULL)
+ /* Don't attempt to use thread_db on targets which can not run
+ (core files). */
+ if (objfile == NULL || !target_has_execution)
{
/* All symbols have been discarded. If the thread_db target is
active, deactivate it now. */