summaryrefslogtreecommitdiff
path: root/gdb/thread-db.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2001-04-26 23:14:20 +0000
committerMichael Snyder <msnyder@specifix.com>2001-04-26 23:14:20 +0000
commit1eb93c8be3f2118012ee08b80f9160bb8d13b917 (patch)
treee6a851255c7229fc5b046bdf49e82f90705d3834 /gdb/thread-db.c
parent44ff0f6c48bd950e857dbf4f59aff26a0c2c24a9 (diff)
downloadgdb-1eb93c8be3f2118012ee08b80f9160bb8d13b917.tar.gz
2001-04-26 Michael Snyder <msnyder@redhat.com>
* thread-db.c (_initialize_thread_db): Add set/show command "debug-linux-threads" for debugging output. * lin-lwp.c (various): Use global "debug_linux_threads to turn on extra debugging output.
Diffstat (limited to 'gdb/thread-db.c')
-rw-r--r--gdb/thread-db.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
index e35775173e7..3d5f7b4d06d 100644
--- a/gdb/thread-db.c
+++ b/gdb/thread-db.c
@@ -31,12 +31,16 @@
#include "symfile.h"
#include "objfiles.h"
#include "target.h"
+#include "command.h"
+#include "gdbcmd.h"
#include "regcache.h"
#ifndef LIBTHREAD_DB_SO
#define LIBTHREAD_DB_SO "libthread_db.so.1"
#endif
+int debug_linux_threads = 0; /* Set non-zero for debugging output. */
+
/* If we're running on Linux, we must explicitly attach to any new threads. */
/* FIXME: There is certainly some room for improvements:
@@ -51,7 +55,7 @@ static struct target_ops thread_db_ops;
static struct target_ops *target_beneath;
/* Pointer to the next function on the objfile event chain. */
-static void (*target_new_objfile_chain) (struct objfile *objfile);
+static void (*new_objfile_event_chain) (struct objfile *objfile);
/* Non-zero if we're using this module's target vector. */
static int using_thread_db;
@@ -588,8 +592,8 @@ thread_db_new_objfile (struct objfile *objfile)
}
quit:
- if (target_new_objfile_chain)
- target_new_objfile_chain (objfile);
+ if (new_objfile_event_chain)
+ new_objfile_event_chain (objfile);
}
static void
@@ -697,11 +701,10 @@ check_event (int pid)
error ("Thread creation event doesn't match breakpoint.");
#endif
- /* We may already know about this thread, for instance when the
- user has issued the `info threads' command before the SIGTRAP
- for hitting the thread creation breakpoint was reported. */
- if (! in_thread_list (pid))
- attach_thread (pid, msg.th_p, &ti, 1);
+ if (in_thread_list (pid))
+ error ("Spurious thread creation event.");
+
+ attach_thread (pid, msg.th_p, &ti, 1);
return;
case TD_DEATH:
@@ -1023,7 +1026,12 @@ _initialize_thread_db (void)
add_target (&thread_db_ops);
/* Add ourselves to objfile event chain. */
- target_new_objfile_chain = target_new_objfile_hook;
+ new_objfile_event_chain = target_new_objfile_hook;
target_new_objfile_hook = thread_db_new_objfile;
}
+ add_show_from_set (add_set_cmd ("debug-linux-threads", class_support,
+ var_boolean, (char *) &debug_linux_threads,
+ "Set debug output for linux-threads \
+on or off.\nUse \"on\" to enable, \"off\" to disable.", &setlist),
+ &showlist);
}