Index: bin/gdb/Makefile =================================================================== RCS file: /cvsroot/src/external/gpl3/gdb/bin/gdb/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- bin/gdb/Makefile 23 Jun 2014 15:05:30 -0000 1.9 +++ bin/gdb/Makefile 7 Feb 2017 17:12:14 -0000 @@ -85,8 +85,6 @@ LDADD+= -lexpat -llzma -lz -lcurses -lintl -lm -lkvm DPADD+= ${LIBEXPAT} ${LIBLZMA} ${LIBZ} ${LIBCURSES} ${LIBINTL} ${LIBM} ${LIBKVM} -LDADD+= -lpthread_dbg - .include .PATH: ${DIST}/gdb ${DIST}/gdb/mi ${DIST}/gdb/cli ${DIST}/gdb/tui \ Index: bin/gdbtui/Makefile =================================================================== RCS file: /cvsroot/src/external/gpl3/gdb/bin/gdbtui/Makefile,v retrieving revision 1.6 diff -u -r1.6 Makefile --- bin/gdbtui/Makefile 22 Jun 2014 23:52:57 -0000 1.6 +++ bin/gdbtui/Makefile 7 Feb 2017 17:12:14 -0000 @@ -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} Index: dist/gdb/nbsd-thread.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gdb/dist/gdb/nbsd-thread.c,v retrieving revision 1.24 diff -u -r1.24 nbsd-thread.c --- dist/gdb/nbsd-thread.c 12 Oct 2016 20:20:33 -0000 1.24 +++ dist/gdb/nbsd-thread.c 7 Feb 2017 17:12:14 -0000 @@ -26,7 +26,6 @@ #include #include -#include #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) @@ -580,170 +470,6 @@ nbsd_thread_activate(); } - -/* - * Process operation callbacks - */ -static int -nbsd_thread_proc_read (void *arg, caddr_t addr, void *buf, size_t size) -{ - int val; - - val = target_read_memory ((CORE_ADDR)(uintptr_t)addr, (gdb_byte *)buf, size); - - if (val == 0) - return 0; - else - return TD_ERR_IO; -} - - -static int -nbsd_thread_proc_write (void *arg, caddr_t addr, void *buf, size_t size) -{ - int val; - - val = target_write_memory ((CORE_ADDR)(uintptr_t)addr, (gdb_byte *)buf, size); - - if (val == 0) - return 0; - else - return TD_ERR_IO; -} - -static int -nbsd_thread_proc_lookup (void *arg, const char *sym, caddr_t *addr) -{ - struct bound_minimal_symbol bms; - - bms = lookup_minimal_symbol (sym, NULL, NULL); - - if (bms.minsym == NULL) - return TD_ERR_NOSYM; - - *addr = (caddr_t)(uintptr_t)BMSYMBOL_VALUE_ADDRESS (bms); - - return 0; - -} - -static int -nbsd_thread_proc_regsize (void *arg, int regset, size_t *size) -{ - switch (regset) - { - case 0: - *size = sizeof (gregset_t); - break; - case 1: -#ifdef HAVE_FPREGS - *size = sizeof (fpregset_t); -#else - *size = 0; -#endif - break; - default: - return TD_ERR_INVAL; - } - - return 0; -} - -static int -nbsd_thread_proc_getregs (void *arg, int regset, int lwp, void *buf) -{ - struct nbsd_thread_proc_arg *a = (struct nbsd_thread_proc_arg *) arg; - struct regcache *cache = a->cache; - struct target_ops *ops = a->ops; - struct cleanup *old_chain; - struct target_ops *beneath = find_target_beneath (ops); - int ret; - - old_chain = save_inferior_ptid (); - - if (target_has_execution) - { - /* Fetching registers from a live process requires that - inferior_ptid is a LWP value rather than a thread value. */ - inferior_ptid = ptid_build (ptid_get_pid (main_ptid), lwp, 0); - beneath->to_fetch_registers (beneath, cache, -1); - } - else - { - /* Fetching registers from a core process requires that - the PID value of inferior_ptid have the funky value that - the kernel drops rather than the real PID. Gross. */ - inferior_ptid = pid_to_ptid ((lwp << 16) | ptid_get_pid (main_ptid)); - beneath->to_fetch_registers (ops, cache, -1); - } - - ret = 0; - switch (regset) - { - case 0: - fill_gregset (cache, (gregset_t *)buf, -1); - break; - case 1: -#ifdef HAVE_FPREGS - fill_fpregset (cache, (fpregset_t *)buf, -1); -#endif - break; - default: /* XXX need to handle other reg sets: SSE, AltiVec, etc. */ - ret = TD_ERR_INVAL; - } - - do_cleanups (old_chain); - - return ret; -} - -static int -nbsd_thread_proc_setregs (void *arg, int regset, int lwp, void *buf) -{ - struct nbsd_thread_proc_arg *a = (struct nbsd_thread_proc_arg *) arg; - struct regcache *cache = a->cache; - struct target_ops *ops = a->ops; - struct cleanup *old_chain; - struct target_ops *beneath = find_target_beneath (ops); - int ret; - - ret = 0; - old_chain = save_inferior_ptid (); - - switch (regset) - { - case 0: - supply_gregset(cache, (gregset_t *)buf); - break; - case 1: -#ifdef HAVE_FPREGS - supply_fpregset(cache, (fpregset_t *)buf); -#endif - break; - default: /* XXX need to handle other reg sets: SSE, AltiVec, etc. */ - ret = TD_ERR_INVAL; - } - - /* Storing registers requires that inferior_ptid is a LWP value - rather than a thread value. */ - inferior_ptid = ptid_build (ptid_get_pid (main_ptid), lwp, 0); - beneath->to_store_registers (beneath, cache, -1); - do_cleanups (old_chain); - - return ret; -} - -static void -init_nbsd_proc_callbacks (void) -{ - nbsd_thread_callbacks.proc_read = nbsd_thread_proc_read; - nbsd_thread_callbacks.proc_write = nbsd_thread_proc_write; - nbsd_thread_callbacks.proc_lookup = nbsd_thread_proc_lookup; - nbsd_thread_callbacks.proc_regsize = nbsd_thread_proc_regsize; - nbsd_thread_callbacks.proc_getregs = nbsd_thread_proc_getregs; - nbsd_thread_callbacks.proc_setregs = nbsd_thread_proc_setregs; -} - static void init_nbsd_thread_ops (void) { @@ -781,7 +507,6 @@ _initialize_nbsd_thread (void) { init_nbsd_thread_ops (); - init_nbsd_proc_callbacks (); add_target (&nbsd_thread_ops);