Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/gdb.old Detach libpthread_dbg(3) from gdb(1) a...
details: https://anonhg.NetBSD.org/src/rev/1aee0368f4f7
branches: trunk
changeset: 351230:1aee0368f4f7
user: kamil <kamil%NetBSD.org@localhost>
date: Wed Feb 08 01:32:37 2017 +0000
description:
Detach libpthread_dbg(3) from gdb(1) and gdbtui (gdb.old)
libpthread_dbg(3) is a remnant library from the M:N thread model
(pre-NetBSD-5.0) API to introspect threads within a process and for use
of debuggers.
Currently in the 1:1 model it's not used in GDB neither in LLDB and it's
not either planned to be used. It's current function to read pthread_t
structures is realizable within a regular debugger capable to
instrospect objects within a tracee (GDB, LLDB...).
pthread_dbg(3) is going to be removed from the base distribution and moved
to pkgsrc.
Patch reviewed by <christos>
Sponsored by <The NetBSD Foundation>
diffstat:
external/gpl3/gdb.old/bin/gdb/Makefile | 4 +-
external/gpl3/gdb.old/bin/gdbtui/Makefile | 4 +-
external/gpl3/gdb.old/dist/gdb/nbsd-thread.c | 111 ---------------------------
3 files changed, 2 insertions(+), 117 deletions(-)
diffs (262 lines):
diff -r 88c47da41204 -r 1aee0368f4f7 external/gpl3/gdb.old/bin/gdb/Makefile
--- a/external/gpl3/gdb.old/bin/gdb/Makefile Tue Feb 07 22:53:19 2017 +0000
+++ b/external/gpl3/gdb.old/bin/gdb/Makefile Wed Feb 08 01:32:37 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2016/10/12 15:36:05 christos Exp $
+# $NetBSD: Makefile,v 1.6 2017/02/08 01:32:37 kamil Exp $
.include <bsd.own.mk>
.include "../Makefile.inc"
@@ -85,8 +85,6 @@
LDADD+= -lexpat -llzma -lz -lcurses -lintl -lm -lkvm
DPADD+= ${LIBEXPAT} ${LIBLZMA} ${LIBZ} ${LIBCURSES} ${LIBINTL} ${LIBM} ${LIBKVM}
-LDADD+= -lpthread_dbg
-
.include <bsd.prog.mk>
.PATH: ${DIST}/gdb ${DIST}/gdb/mi ${DIST}/gdb/cli ${DIST}/gdb/tui \
diff -r 88c47da41204 -r 1aee0368f4f7 external/gpl3/gdb.old/bin/gdbtui/Makefile
--- a/external/gpl3/gdb.old/bin/gdbtui/Makefile Tue Feb 07 22:53:19 2017 +0000
+++ b/external/gpl3/gdb.old/bin/gdbtui/Makefile Wed Feb 08 01:32:37 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2016/10/12 15:36:05 christos Exp $
+# $NetBSD: Makefile,v 1.6 2017/02/08 01:32:37 kamil Exp $
.include "../Makefile.inc"
@@ -71,7 +71,5 @@
LDADD+= -lexpat -llzma -lz -lcurses -lintl -lm -lkvm
DPADD+= ${LIBEXPAT} ${LIBLZMA} ${LIBZ} ${LIBCURSES} ${LIBINTL} ${LIBM} ${LIBKVM}
-LDADD+= -lpthread_dbg
-
.PATH: ${DIST}/gdb ${DIST}/gdb/mi ${DIST}/gdb/cli ${DIST}/gdb/tui \
${DIST}/gdb/signals ${DIST}/gdb/doc ${.CURDIR}/../arch/${GDB_MACHINE_ARCH}
diff -r 88c47da41204 -r 1aee0368f4f7 external/gpl3/gdb.old/dist/gdb/nbsd-thread.c
--- a/external/gpl3/gdb.old/dist/gdb/nbsd-thread.c Tue Feb 07 22:53:19 2017 +0000
+++ b/external/gpl3/gdb.old/dist/gdb/nbsd-thread.c Wed Feb 08 01:32:37 2017 +0000
@@ -26,7 +26,6 @@
#include <sys/ptrace.h>
#include <pthread.h>
-#include <pthread_dbg.h>
#include "symtab.h"
#include "symfile.h"
@@ -78,14 +77,10 @@
struct target_ops nbsd_thread_ops;
-struct td_proc_callbacks_t nbsd_thread_callbacks;
-
static ptid_t find_active_thread (void);
static void nbsd_update_thread_list (struct target_ops *);
-static td_proc_t *main_ta;
-
struct nbsd_thread_proc_arg {
struct target_ops *ops;
struct regcache *cache;
@@ -101,36 +96,6 @@
char *str;
};
-static char *
-td_err_string (int errcode)
-{
- static struct string_map
- td_err_table[] =
- {
- {TD_ERR_OK, "generic \"call succeeded\""},
- {TD_ERR_ERR, "generic error."},
- {TD_ERR_NOSYM, "symbol not found"},
- {TD_ERR_NOOBJ, "no object can be found to satisfy query"},
- {TD_ERR_BADTHREAD, "thread can not answer request"},
- {TD_ERR_INUSE, "debugging interface already in use for this process"},
- {TD_ERR_NOLIB, "process is not using libpthread"},
- {TD_ERR_NOMEM, "out of memory"},
- {TD_ERR_IO, "process callback error"},
- {TD_ERR_INVAL, "invalid argument"},
- };
- const int td_err_size = sizeof td_err_table / sizeof (struct string_map);
- int i;
- static char buf[90];
-
- for (i = 0; i < td_err_size; i++)
- if (td_err_table[i].num == errcode)
- return td_err_table[i].str;
-
- sprintf (buf, "Unknown thread_db error code: %d", errcode);
-
- return buf;
-}
-
static void
nbsd_thread_activate (void)
{
@@ -172,11 +137,6 @@
static void
nbsd_thread_post_attach (struct target_ops *ops, int pid)
{
-#if 0
- struct target_ops *beneath = find_target_beneath (ops);
- beneath->to_post_attach (ops, pid);
-#endif
-
if (nbsd_thread_present && !nbsd_thread_active)
nbsd_thread_activate ();
}
@@ -195,7 +155,6 @@
{
struct target_ops *beneath = find_target_beneath (ops);
unpush_target (ops);
- td_close (main_ta);
/* Ordinarily, gdb caches solib information, but this means that it
won't call the new_obfile hook on a reattach. Clear the symbol file
cache so that attach -> detach -> attach works. */
@@ -207,22 +166,6 @@
static int nsusp;
static int nsuspalloc;
-static td_thread_t **susp;
-
-#ifdef notdef
-static int
-thread_resume_suspend_cb (td_thread_t *th, void *arg)
-{
- int val;
- ptid_t *pt = arg;
- td_thread_info_t ti;
-
- if (td_thr_info (th, &ti) != 0)
- return -1;
-
- return 0;
-}
-#endif
static void
nbsd_thread_resume (struct target_ops *ops, ptid_t ptid, int step,
@@ -245,27 +188,10 @@
}
-static void
-nbsd_thread_unsuspend(void)
-{
- int i, val;
-
- for (i = 0; i < nsusp; i++)
- {
- val = td_thr_resume(susp[i]);
- if (val != 0)
- error ("nbsd_thread_unsuspend: td_thr_resume(%p): %s", susp[i],
- td_err_string (val));
- }
- nsusp = 0;
-}
-
static ptid_t
find_active_thread (void)
{
int val;
- td_thread_t *thread;
- td_thread_info_t ti;
struct ptrace_lwpinfo pl;
if (!ptid_equal (cached_thread, minus_one_ptid))
@@ -305,8 +231,6 @@
rtnval = beneath->to_wait (beneath, ptid, ourstatus, options);
- nbsd_thread_unsuspend();
-
if (nbsd_thread_active && (ourstatus->kind != TARGET_WAITKIND_EXITED))
{
rtnval = find_active_thread ();
@@ -324,7 +248,6 @@
int regno)
{
struct target_ops *beneath = find_target_beneath (ops);
- td_thread_t *thread;
gregset_t gregs;
#ifdef HAVE_FPREGS
fpregset_t fpregs;
@@ -349,7 +272,6 @@
int regno)
{
struct target_ops *beneath = find_target_beneath (ops);
- td_thread_t *thread;
gregset_t gregs;
#ifdef HAVE_FPREGS
fpregset_t fpregs;
@@ -412,7 +334,6 @@
nbsd_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[100];
- td_thread_t *th;
char name[32];
if ((ptid_get_lwp(ptid) == 0) &&
@@ -424,23 +345,6 @@
return buf;
}
-
-#ifdef notdef
-static void
-nbsd_add_to_thread_list (bfd *abfd, asection *asect, PTR reg_sect_arg)
-{
- int regval;
- td_thread_t *dummy;
-
- if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
- return;
-
- regval = atoi (bfd_section_name (abfd, asect) + 5);
-
- add_thread (ptid_build (ptid_get_pid (main_ptid), regval, 0));
-}
-#endif
-
/* This routine is called whenever a new symbol table is read in, or when all
symbol tables are removed. libthread_db can only be initialized when it
finds the right variables in libthread.so. Since it's a shared library,
@@ -467,18 +371,6 @@
goto quit;
- /* Now, initialize the thread debugging library. This needs to be
- done after the shared libraries are located because it needs
- information from the user's thread library. */
- val = td_open (&nbsd_thread_callbacks, &main_arg, &main_ta);
- if (val == TD_ERR_NOLIB)
- goto quit;
- else if (val != 0)
- {
- warning ("nbsd_thread_new_objfile: td_open: %s", td_err_string (val));
- goto quit;
- }
-
nbsd_thread_present = 1;
if ((nbsd_thread_core == 0) &&
@@ -496,8 +388,6 @@
nbsd_thread_alive (struct target_ops *ops, ptid_t ptid)
{
struct target_ops *beneath = find_target_beneath (ops);
- td_thread_t *th;
- td_thread_info_t ti;
int val;
if (nbsd_thread_active)
@@ -781,7 +671,6 @@
_initialize_nbsd_thread (void)
{
init_nbsd_thread_ops ();
- init_nbsd_proc_callbacks ();
add_target (&nbsd_thread_ops);
Home |
Main Index |
Thread Index |
Old Index