PERFORCE change 60326 for review
Peter Wemm
peter at FreeBSD.org
Mon Aug 23 14:57:34 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=60326
Change 60326 by peter at peter_daintree on 2004/08/23 21:57:12
IFC @60325
Affected files ...
.. //depot/projects/hammer/UPDATING#49 integrate
.. //depot/projects/hammer/contrib/gcc/config/freebsd-spec.h#11 integrate
.. //depot/projects/hammer/contrib/pf/pfctl/pfctl_table.c#4 integrate
.. //depot/projects/hammer/games/fortune/datfiles/fortunes#28 integrate
.. //depot/projects/hammer/gnu/usr.bin/gdb/libgdb/Makefile#3 integrate
.. //depot/projects/hammer/gnu/usr.bin/gdb/libgdb/fbsd-threads.c#4 integrate
.. //depot/projects/hammer/include/_ctype.h#2 integrate
.. //depot/projects/hammer/lib/csu/alpha/crt1.c#4 integrate
.. //depot/projects/hammer/lib/libc/gen/glob.3#6 integrate
.. //depot/projects/hammer/lib/libc/gen/tls.c#3 integrate
.. //depot/projects/hammer/lib/libc/locale/frune.c#5 integrate
.. //depot/projects/hammer/lib/libc/locale/isalnum.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/isalpha.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/isblank.3#5 integrate
.. //depot/projects/hammer/lib/libc/locale/iscntrl.3#5 integrate
.. //depot/projects/hammer/lib/libc/locale/isdigit.3#5 integrate
.. //depot/projects/hammer/lib/libc/locale/isgraph.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/islower.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/isprint.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/ispunct.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/isspace.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/isupper.3#4 integrate
.. //depot/projects/hammer/lib/libc/locale/isxdigit.3#6 integrate
.. //depot/projects/hammer/lib/libc/locale/mbrune.3#6 integrate
.. //depot/projects/hammer/lib/libc/locale/mbrune.c#4 integrate
.. //depot/projects/hammer/lib/libc/locale/rune.3#8 integrate
.. //depot/projects/hammer/lib/libc/locale/setinvalidrune.c#4 integrate
.. //depot/projects/hammer/lib/libc/locale/setrunelocale.c#16 integrate
.. //depot/projects/hammer/lib/libc/locale/tolower.3#3 integrate
.. //depot/projects/hammer/lib/libc/locale/toupper.3#3 integrate
.. //depot/projects/hammer/lib/libc/locale/utf2.5#3 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_init.c#17 integrate
.. //depot/projects/hammer/lib/libutil/fparseln.3#2 integrate
.. //depot/projects/hammer/libexec/lukemftpd/config.h#3 integrate
.. //depot/projects/hammer/libexec/rbootd/rbootd.c#2 integrate
.. //depot/projects/hammer/release/doc/de_DE.ISO8859-1/errata/article.sgml#5 integrate
.. //depot/projects/hammer/release/doc/de_DE.ISO8859-1/readme/article.sgml#6 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/errata/article.sgml#19 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#55 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/readme/article.sgml#10 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#74 integrate
.. //depot/projects/hammer/release/doc/fr_FR.ISO8859-1/errata/article.sgml#4 integrate
.. //depot/projects/hammer/release/doc/ja_JP.eucJP/errata/article.sgml#13 integrate
.. //depot/projects/hammer/release/doc/ru_RU.KOI8-R/readme/article.sgml#3 integrate
.. //depot/projects/hammer/release/doc/share/misc/dev.archlist.txt#4 integrate
.. //depot/projects/hammer/release/doc/share/sgml/release.ent#12 integrate
.. //depot/projects/hammer/release/sparc64/mkisoimages.sh#7 integrate
.. //depot/projects/hammer/sbin/geom/class/raid3/geom_raid3.c#3 integrate
.. //depot/projects/hammer/sbin/geom/class/raid3/graid3.8#2 integrate
.. //depot/projects/hammer/sbin/geom/core/geom.8#6 integrate
.. //depot/projects/hammer/sbin/ipfw/ipfw2.c#28 integrate
.. //depot/projects/hammer/share/man/man4/hfa.4#3 integrate
.. //depot/projects/hammer/share/man/man4/ixgb.4#4 integrate
.. //depot/projects/hammer/share/man/man4/mac_bsdextended.4#6 integrate
.. //depot/projects/hammer/share/man/man9/suser.9#6 integrate
.. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#67 integrate
.. //depot/projects/hammer/sys/amd64/amd64/pmap.c#100 integrate
.. //depot/projects/hammer/sys/boot/alpha/Makefile.inc#3 integrate
.. //depot/projects/hammer/sys/boot/alpha/common/Makefile.common#4 integrate
.. //depot/projects/hammer/sys/boot/alpha/common/ldscript#1 branch
.. //depot/projects/hammer/sys/boot/common/load.c#3 integrate
.. //depot/projects/hammer/sys/boot/ficl/Makefile#9 integrate
.. //depot/projects/hammer/sys/compat/linux/linux_socket.c#13 integrate
.. //depot/projects/hammer/sys/conf/files#76 integrate
.. //depot/projects/hammer/sys/conf/options.pc98#24 integrate
.. //depot/projects/hammer/sys/contrib/pf/net/pf_ioctl.c#11 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi.c#46 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi_pci_link.c#17 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi_resource.c#15 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpivar.h#34 integrate
.. //depot/projects/hammer/sys/dev/aic7xxx/aic79xx_pci.c#15 integrate
.. //depot/projects/hammer/sys/dev/aic7xxx/aic7xxx_pci.c#10 integrate
.. //depot/projects/hammer/sys/dev/ata/ata-queue.c#15 integrate
.. //depot/projects/hammer/sys/dev/fdc/fdc.c#13 integrate
.. //depot/projects/hammer/sys/dev/isp/isp_freebsd.c#14 integrate
.. //depot/projects/hammer/sys/dev/lnc/if_lnc_pci.c#9 integrate
.. //depot/projects/hammer/sys/dev/md/md.c#35 integrate
.. //depot/projects/hammer/sys/dev/mpt/mpt.c#6 integrate
.. //depot/projects/hammer/sys/dev/mpt/mpt_debug.c#5 integrate
.. //depot/projects/hammer/sys/dev/mpt/mpt_freebsd.c#10 integrate
.. //depot/projects/hammer/sys/dev/sound/pci/maestro.c#7 integrate
.. //depot/projects/hammer/sys/geom/mirror/g_mirror.c#3 integrate
.. //depot/projects/hammer/sys/geom/raid3/g_raid3.c#3 integrate
.. //depot/projects/hammer/sys/geom/raid3/g_raid3.h#2 integrate
.. //depot/projects/hammer/sys/geom/raid3/g_raid3_ctl.c#2 integrate
.. //depot/projects/hammer/sys/geom/vinum/geom_vinum_raid5.c#4 integrate
.. //depot/projects/hammer/sys/geom/vinum/geom_vinum_rm.c#2 integrate
.. //depot/projects/hammer/sys/geom/vinum/geom_vinum_subr.c#6 integrate
.. //depot/projects/hammer/sys/i386/conf/NOTES#51 integrate
.. //depot/projects/hammer/sys/i386/i386/mp_machdep.c#31 integrate
.. //depot/projects/hammer/sys/i386/i386/nexus.c#14 integrate
.. //depot/projects/hammer/sys/i386/i386/p4tcc.c#4 integrate
.. //depot/projects/hammer/sys/i386/i386/pmap.c#49 integrate
.. //depot/projects/hammer/sys/i386/i386/uio_machdep.c#5 integrate
.. //depot/projects/hammer/sys/kern/kern_lock.c#11 integrate
.. //depot/projects/hammer/sys/kern/sched_4bsd.c#25 integrate
.. //depot/projects/hammer/sys/kern/subr_kdb.c#4 integrate
.. //depot/projects/hammer/sys/kern/subr_smp.c#20 integrate
.. //depot/projects/hammer/sys/modules/agp/Makefile#6 integrate
.. //depot/projects/hammer/sys/modules/ipfw/Makefile#3 integrate
.. //depot/projects/hammer/sys/net/if_fwsubr.c#4 integrate
.. //depot/projects/hammer/sys/net/if_sl.c#17 integrate
.. //depot/projects/hammer/sys/net/route.c#16 integrate
.. //depot/projects/hammer/sys/net/rtsock.c#16 integrate
.. //depot/projects/hammer/sys/netinet/ip_mroute.c#22 integrate
.. //depot/projects/hammer/sys/netinet/ip_output.c#36 integrate
.. //depot/projects/hammer/sys/netinet/raw_ip.c#27 integrate
.. //depot/projects/hammer/sys/netinet/udp_usrreq.c#23 integrate
.. //depot/projects/hammer/sys/netinet6/in6.c#12 integrate
.. //depot/projects/hammer/sys/netinet6/in6_ifattach.c#9 integrate
.. //depot/projects/hammer/sys/netinet6/in6_pcb.c#17 integrate
.. //depot/projects/hammer/sys/netinet6/in6_prefix.c#4 delete
.. //depot/projects/hammer/sys/netinet6/in6_prefix.h#2 delete
.. //depot/projects/hammer/sys/netinet6/in6_proto.c#8 integrate
.. //depot/projects/hammer/sys/netinet6/ip6_input.c#16 integrate
.. //depot/projects/hammer/sys/netinet6/nd6.c#13 integrate
.. //depot/projects/hammer/sys/pc98/pc98/fd.c#22 integrate
.. //depot/projects/hammer/sys/pci/agp_ali.c#10 integrate
.. //depot/projects/hammer/sys/pci/agp_intel.c#13 integrate
.. //depot/projects/hammer/sys/security/mac_bsdextended/mac_bsdextended.c#11 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/uio_machdep.c#6 integrate
.. //depot/projects/hammer/sys/sys/fdcio.h#3 integrate
.. //depot/projects/hammer/sys/sys/param.h#43 integrate
.. //depot/projects/hammer/sys/sys/smp.h#7 integrate
.. //depot/projects/hammer/sys/ufs/ufs/ufs_vnops.c#18 integrate
.. //depot/projects/hammer/sys/vm/vm_fault.c#22 integrate
.. //depot/projects/hammer/sys/vm/vm_page.h#18 integrate
.. //depot/projects/hammer/tools/regression/geom_raid3/test-10.sh#1 branch
.. //depot/projects/hammer/tools/regression/geom_raid3/test-11.sh#1 branch
.. //depot/projects/hammer/tools/regression/geom_raid3/test-12.sh#1 branch
.. //depot/projects/hammer/tools/tools/nanobsd/i386.diskimage#7 integrate
.. //depot/projects/hammer/usr.bin/calendar/calendars/calendar.freebsd#24 integrate
.. //depot/projects/hammer/usr.bin/mklocale/mklocale.1#10 integrate
.. //depot/projects/hammer/usr.sbin/kbdcontrol/kbdmap.5#3 integrate
Differences ...
==== //depot/projects/hammer/UPDATING#49 (text+ko) ====
@@ -8,8 +8,10 @@
/usr/ports/UPDATING. Please read that file before running
portupgrade. Important recent entries: 20040724 (default X changes).
-NOTE TO PEOPLE WHO THINK THAT FreeBSD 5.x IS SLOW:
- FreeBSD 5.x has many debugging features turned on, in
+[[ The UPDATING file will be trimmed to 20040814 on or about Oct 1, 2004 ]]
+
+NOTE TO PEOPLE WHO THINK THAT FreeBSD 6.x IS SLOW:
+ FreeBSD 6.x has many debugging features turned on, in
both the kernel and userland. These features attempt to detect
incorrect use of system primitives, and encourage loud failure
through extra sanity checking and fail stop semantics. They
@@ -27,7 +29,7 @@
Netgraph using utilities (e.g. ngctl, nghook, ppp, mpd,
pppoed, bluetooth, ATM) should be recompiled when a new kernel
is installed.
-
+
20040817:
IPFW has been converted to use PFIL_HOOKS. This change is
transparent to userland and preserves the ipfw ABI. The ipfw
@@ -69,11 +71,15 @@
compiler upgrade, there are several issues to be aware of. GCC 3.4.x
has broken C++ ABI compatibility with previous releases yet again
and users will have to rebuild all their C++ programs with the new
- compiler. A new unit-at-a-time optimization mode, which is default
- in this compiler release, is more aggressive in removing unused
- static symbols. This is the likely cause of 'make buildworld'
- breakages with non-default CFLAGS where optimization level is set
- to -O2 or higher.
+ compiler. If you are getting run-time error such as
+ /libexec/ld-elf.so.1: Undefined symbol "_ZNSs20_S_empty_rep_storageE"
+ This entry does apply to you.
+
+ A new unit-at-a-time optimization mode, which is default in this
+ compiler release, is more aggressive in removing unused static
+ symbols. This is the likely cause of 'make buildworld' breakages
+ with non-default CFLAGS where optimization level is set to -O2
+ or higher.
With the upgrade of the system compiler, the kernel has been upgraded
to match the new system compiler. This makes it impossible to build
@@ -1566,6 +1572,12 @@
COMMON ITEMS:
+ # NOTE: 5.x below applies to 6.0-currrent as well, for the
+ # momemnt. 4.any -> 5.any upgrade support will remain in
+ # place for 6.0 current, but after 5.3 RELEASE, the 4.any ->
+ # 6.0-current upgrade path will require moving through 5.3
+ # RELEASE or newer.
+
General Notes
-------------
Avoid using make -j when upgrading. From time to time in the
@@ -1788,4 +1800,4 @@
Contact Warner Losh if you have any questions about your use of
this document.
-$FreeBSD: src/UPDATING,v 1.345 2004/08/20 01:24:23 julian Exp $
+$FreeBSD: src/UPDATING,v 1.348 2004/08/23 18:51:36 imp Exp $
==== //depot/projects/hammer/contrib/gcc/config/freebsd-spec.h#11 (text+ko) ====
@@ -18,7 +18,7 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* $FreeBSD: src/contrib/gcc/config/freebsd-spec.h,v 1.17 2004/07/28 04:31:47 kan Exp $ */
+/* $FreeBSD: src/contrib/gcc/config/freebsd-spec.h,v 1.18 2004/08/21 03:58:39 obrien Exp $ */
/* Common FreeBSD configuration.
All FreeBSD architectures should include this file, which will specify
@@ -79,7 +79,7 @@
#ifdef FREEBSD_NATIVE
#define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS() \
do { \
- builtin_define_std ("__FreeBSD_cc_version=520001"); \
+ builtin_define_std ("__FreeBSD_cc_version=600001"); \
} while (0)
#else
#define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS() \
==== //depot/projects/hammer/contrib/pf/pfctl/pfctl_table.c#4 (text+ko) ====
@@ -1,4 +1,5 @@
/* $OpenBSD: pfctl_table.c,v 1.59 2004/03/15 15:25:44 dhartmei Exp $ */
+/* add $OpenBSD: pfctl_table.c,v 1.61 2004/06/12 22:22:44 cedric Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -31,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/contrib/pf/pfctl/pfctl_table.c,v 1.5 2004/06/16 23:39:31 mlaier Exp $");
+__FBSDID("$FreeBSD: src/contrib/pf/pfctl/pfctl_table.c,v 1.6 2004/08/22 16:58:06 mlaier Exp $");
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -88,7 +89,13 @@
#define CREATE_TABLE do { \
table.pfrt_flags |= PFR_TFLAG_PERSIST; \
- RVTEST(pfr_add_tables(&table, 1, &nadd, flags)); \
+ if ((!(opts & PF_OPT_NOACTION) || \
+ (opts & PF_OPT_DUMMYACTION)) && \
+ (pfr_add_tables(&table, 1, &nadd, flags)) && \
+ (errno != EPERM)) { \
+ radix_perror(); \
+ goto _error; \
+ } \
if (nadd) { \
warn_namespace_collision(table.pfrt_name); \
xprintf(opts, "%d table created", nadd); \
==== //depot/projects/hammer/games/fortune/datfiles/fortunes#28 (text+ko) ====
@@ -1,5 +1,5 @@
This fortune brought to you by:
-$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.142 2004/08/20 13:39:28 des Exp $
+$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.143 2004/08/23 11:00:20 blackend Exp $
%
-- Gifts for Children --
@@ -5638,7 +5638,7 @@
Come I to make this gig at Caesar's laying down.
%
Frisbeetarianism, n.:
- The belief that when you die, your soul goes up the on roof and
+ The belief that when you die, your soul goes up on the roof and
gets stuck.
%
Frobnicate, v.:
==== //depot/projects/hammer/gnu/usr.bin/gdb/libgdb/Makefile#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/gnu/usr.bin/gdb/libgdb/Makefile,v 1.2 2004/08/08 22:45:36 davidxu Exp $
+# $FreeBSD: src/gnu/usr.bin/gdb/libgdb/Makefile,v 1.3 2004/08/22 10:59:33 davidxu Exp $
LIB= gdb
INTERNALLIB= yes
@@ -37,10 +37,14 @@
tui-stack.c tui-win.c tui-windata.c tui-wingeneral.c \
tui-winsource.c typeprint.c ui-file.c ui-out.c user-regs.c \
utils.c valarith.c valops.c valprint.c values.c varobj.c \
- wrapper.c fbsd-threads.c ${LIBSRCS}
+ wrapper.c ${LIBSRCS}
GENSRCS= version.c
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+LIBSRCS+= fbsd-threads.c
+.endif
+
version.c:
echo '#include "version.h"' > ${.TARGET}
echo 'const char version[] = ${VERSION};' >> ${.TARGET}
==== //depot/projects/hammer/gnu/usr.bin/gdb/libgdb/fbsd-threads.c#4 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c,v 1.4 2004/08/08 22:45:36 davidxu Exp $ */
+/* $FreeBSD: src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c,v 1.7 2004/08/22 09:05:57 davidxu Exp $ */
/* FreeBSD libthread_db assisted debugging support.
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -19,25 +19,28 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "defs.h"
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/ptrace.h>
-#include "gdb_assert.h"
-#include <dlfcn.h>
#include "proc_service.h"
#include "thread_db.h"
+#include "defs.h"
#include "bfd.h"
+#include "elf-bfd.h"
+#include "gdb_assert.h"
+#include "gdbcore.h"
#include "gdbthread.h"
#include "inferior.h"
+#include "objfiles.h"
+#include "regcache.h"
#include "symfile.h"
#include "symtab.h"
-#include "objfiles.h"
#include "target.h"
-#include "regcache.h"
#include "gdbcmd.h"
#include "solib-svr4.h"
-#include <sys/ptrace.h>
#define LIBTHREAD_DB_SO "libthread_db.so"
@@ -46,18 +49,29 @@
pid_t pid;
};
+extern int child_suppress_run;
+
extern struct target_ops child_ops;
-/* This module's target vector. */
-static struct target_ops thread_db_ops;
+/* This module's target vectors. */
+static struct target_ops fbsd_thread_ops;
+static struct target_ops fbsd_core_ops;
+
+/* Saved copy of orignal core_ops. */
+static struct target_ops orig_core_ops;
+extern struct target_ops core_ops;
-static struct target_ops base_ops;
-
/* Pointer to the next function on the objfile event chain. */
static void (*target_new_objfile_chain) (struct objfile *objfile);
+/* Non-zero if there is a thread module */
+static int fbsd_thread_present;
+
/* Non-zero if we're using this module's target vector. */
-static int using_thread_db;
+static int fbsd_thread_active;
+
+/* Non-zero if core_open is called */
+static int fbsd_thread_core = 0;
/* Non-zero if we have to keep this module's target vector active
across re-runs. */
@@ -78,6 +92,7 @@
static td_err_e (*td_init_p) (void);
static td_err_e (*td_ta_new_p) (struct ps_prochandle *ps, td_thragent_t **ta);
+static td_err_e (*td_ta_delete_p) (td_thragent_t *);
static td_err_e (*td_ta_map_id2thr_p) (const td_thragent_t *ta, thread_t pt,
td_thrhandle_t *__th);
static td_err_e (*td_ta_map_lwp2thr_p) (const td_thragent_t *ta, lwpid_t lwpid,
@@ -93,7 +108,6 @@
td_thr_events_t *event);
static td_err_e (*td_ta_event_getmsg_p) (const td_thragent_t *ta,
td_event_msg_t *msg);
-static td_err_e (*td_thr_validate_p) (const td_thrhandle_t *th);
static td_err_e (*td_thr_get_info_p) (const td_thrhandle_t *th,
td_thrinfo_t *infop);
static td_err_e (*td_thr_getfpregs_p) (const td_thrhandle_t *th,
@@ -222,24 +236,46 @@
gdb_assert (IS_LWP (ptid));
- err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
- if (err == TD_OK)
+ if (fbsd_thread_active)
{
- err = td_thr_get_info_p (&th, &ti);
- if (err != TD_OK)
- error ("Cannot get thread info: %s", thread_db_err_str (err));
- return BUILD_THREAD (ti.ti_tid, GET_PID (ptid));
+ err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
+ if (err == TD_OK)
+ {
+ err = td_thr_get_info_p (&th, &ti);
+ if (err != TD_OK)
+ error ("Cannot get thread info: %s", thread_db_err_str (err));
+ return BUILD_THREAD (ti.ti_tid, GET_PID (ptid));
+ }
}
/* the LWP is not mapped to user thread */
return BUILD_LWP (GET_LWP (ptid), GET_PID (ptid));
}
+static void
+fbsd_core_get_first_lwp (bfd *abfd, asection *asect, void *obj)
+{
+ if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
+ return;
+
+ if (*(lwpid_t *)obj != 0)
+ return;
+
+ *(lwpid_t *)obj = atoi (bfd_section_name (abfd, asect) + 5);
+}
+
static long
get_current_lwp (int pid)
{
struct ptrace_lwpinfo pl;
+ lwpid_t lwpid;
+ if (!target_has_execution)
+ {
+ lwpid = 0;
+ bfd_map_over_sections (core_bfd, fbsd_core_get_first_lwp, &lwpid);
+ return lwpid;
+ }
if (ptrace (PT_LWPINFO, pid, (caddr_t)&pl, sizeof(pl)))
perror_with_name("PT_LWPINFO");
@@ -263,31 +299,50 @@
}
static void
+fbsd_thread_activate (void)
+{
+ fbsd_thread_active = 1;
+ init_thread_list();
+ fbsd_thread_find_new_threads ();
+ get_current_thread ();
+}
+
+static void
+fbsd_thread_deactivate (void)
+{
+ td_ta_delete_p (thread_agent);
+
+ inferior_ptid = pid_to_ptid (proc_handle.pid);
+ proc_handle.pid = 0;
+ fbsd_thread_active = 0;
+ fbsd_thread_present = 0;
+ init_thread_list ();
+}
+
+static void
fbsd_thread_new_objfile (struct objfile *objfile)
{
td_err_e err;
- /* Don't attempt to use thread_db on targets which can not run
- (core files). */
- if (objfile == NULL || !target_has_execution)
+ if (objfile == NULL)
{
/* All symbols have been discarded. If the thread_db target is
active, deactivate it now. */
- if (using_thread_db)
+ if (fbsd_thread_active)
{
gdb_assert (proc_handle.pid == 0);
- unpush_target (&thread_db_ops);
- using_thread_db = 0;
+ fbsd_thread_active = 0;
}
- keep_thread_db = 0;
-
goto quit;
}
- if (using_thread_db)
- /* Nothing to do. The thread library was already detected and the
- target vector was already activated. */
+ if (!child_suppress_run)
+ goto quit;
+
+ /* Nothing to do. The thread library was already detected and the
+ target vector was already activated. */
+ if (fbsd_thread_active)
goto quit;
/* Initialize the structure that identifies the child process. Note
@@ -305,32 +360,21 @@
case TD_OK:
/* The thread library was detected. Activate the thread_db target. */
- base_ops = current_target;
- push_target (&thread_db_ops);
- using_thread_db = 1;
-
- /* If the thread library was detected in the main symbol file
- itself, we assume that the program was statically linked
- against the thread library and well have to keep this
- module's target vector activated until forever... Well, at
- least until all symbols have been discarded anyway (see
- above). */
- if (objfile == symfile_objfile)
- {
- gdb_assert (proc_handle.pid == 0);
- keep_thread_db = 1;
- }
+ fbsd_thread_present = 1;
/* We can only poke around if there actually is a child process.
If there is no child process alive, postpone the steps below
until one has been created. */
- if (proc_handle.pid != 0)
+ if (fbsd_thread_core == 0 && proc_handle.pid != 0)
{
- fbsd_thread_find_new_threads ();
- get_current_thread ();
+ push_target(&fbsd_thread_ops);
+ fbsd_thread_activate();
}
else
- printf_filtered("%s postpone processing\n", __func__);
+ {
+ td_ta_delete_p(thread_agent);
+ thread_agent = NULL;
+ }
break;
default:
@@ -347,23 +391,41 @@
static void
fbsd_thread_attach (char *args, int from_tty)
{
+ fbsd_thread_core = 0;
+
child_ops.to_attach (args, from_tty);
- /* Destroy thread info; it's no longer valid. */
- init_thread_list ();
+ /* Must get symbols from solibs before libthread_db can run! */
+ SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0, auto_solib_add);
+
+ if (fbsd_thread_present && !fbsd_thread_active)
+ push_target(&fbsd_thread_ops);
+}
- /* The child process is now the actual multi-threaded
- program. Snatch its process ID... */
- proc_handle.pid = GET_PID (inferior_ptid);
+static void
+fbsd_thread_post_attach (int pid)
+{
+ child_ops.to_post_attach (pid);
- /* ...and perform the remaining initialization steps. */
- fbsd_thread_find_new_threads();
- get_current_thread ();
+ if (fbsd_thread_present && !fbsd_thread_active)
+ {
+ proc_handle.pid = GET_PID (inferior_ptid);
+ fbsd_thread_activate ();
+ }
}
static void
fbsd_thread_detach (char *args, int from_tty)
{
+ fbsd_thread_deactivate ();
+ unpush_target (&fbsd_thread_ops);
+
+ /* Clear gdb solib information and symbol file
+ cache, so that after detach and re-attach, new_objfile
+ hook will be called */
+
+ clear_solib();
+ symbol_file_clear(0);
proc_handle.pid = 0;
child_ops.to_detach (args, from_tty);
}
@@ -373,7 +435,7 @@
{
int err = td_thr_dbsuspend_p (th_p);
if (err != 0)
- printf_filtered("%s %s\n", __func__, thread_db_err_str (err));
+ fprintf_filtered(gdb_stderr, "%s %s\n", __func__, thread_db_err_str (err));
return (err);
}
@@ -382,7 +444,7 @@
{
int err = td_thr_dbresume_p (th_p);
if (err != 0)
- printf_filtered("%s %s\n", __func__, thread_db_err_str (err));
+ fprintf_filtered(gdb_stderr, "%s %s\n", __func__, thread_db_err_str (err));
return (err);
}
@@ -395,17 +457,9 @@
int resume_all, ret;
long lwp, thvalid = 0;
-#if 0
- printf_filtered("%s ptid=%ld.%ld.%ld step=%d\n", __func__,
- GET_PID(ptid), GET_LWP(ptid), GET_THREAD(ptid), step);
- printf_filtered("%s inferior_ptid=%ld.%ld.%ld\n", __func__,
- GET_PID(inferior_ptid), GET_LWP(inferior_ptid),
- GET_THREAD(inferior_ptid));
-#endif
-
- if (proc_handle.pid == 0)
+ if (!fbsd_thread_active)
{
- base_ops.to_resume (ptid, step, signo);
+ child_ops.to_resume (ptid, step, signo);
return;
}
@@ -428,14 +482,12 @@
if (ret)
error (thread_db_err_str (ret));
- /*
- * For M:N thread, we need to tell UTS to set/unset single step
- * flag at context switch time, the flag will be written into
- * thread mailbox. This becauses some architecture may not have
- * machine single step flag in ucontext, so we put the flag in mailbox,
- * when the thread switches back, kse_switchin restores the single step
- * state.
- */
+ /* For M:N thread, we need to tell UTS to set/unset single step
+ flag at context switch time, the flag will be written into
+ thread mailbox. This becauses some architecture may not have
+ machine single step flag in ucontext, so we put the flag in mailbox,
+ when the thread switches back, kse_switchin restores the single step
+ state. */
ret = td_thr_sstep_p (&th, step);
if (ret)
error (thread_db_err_str (ret));
@@ -502,7 +554,7 @@
ret = child_ops.to_wait (ptid, ourstatus);
if (GET_PID(ret) >= 0 && ourstatus->kind == TARGET_WAITKIND_STOPPED)
{
- lwp = get_current_lwp (proc_handle.pid);
+ lwp = get_current_lwp (GET_PID(ret));
ret = thread_from_lwp (BUILD_LWP (lwp, GET_PID (ret)));
if (!in_thread_list (ret))
add_thread (ret);
@@ -525,8 +577,16 @@
fbsd_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct mem_attrib *attrib, struct target_ops *target)
{
- return base_ops.to_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ int err;
+
+ if (target_has_execution)
+ err = child_ops.to_xfer_memory (memaddr, myaddr, len, write, attrib,
+ target);
+ else
+ err = orig_core_ops.to_xfer_memory (memaddr, myaddr, len, write, attrib,
+ target);
+
+ return (err);
}
static void
@@ -536,7 +596,12 @@
fpregset_t fpregs;
lwpid_t lwp;
- /* FIXME, use base_ops to fetch lwp registers! */
+ if (!target_has_execution)
+ {
+ orig_core_ops.to_fetch_registers (-1);
+ return;
+ }
+
lwp = GET_LWP (inferior_ptid);
if (ptrace (PT_GETREGS, lwp, (caddr_t) &gregs, 0) == -1)
@@ -675,14 +740,17 @@
child_ops.to_kill();
}
+static int
+fbsd_thread_can_run (void)
+{
+ return child_suppress_run;
+}
+
static void
fbsd_thread_create_inferior (char *exec_file, char *allargs, char **env)
{
- if (!keep_thread_db)
- {
- unpush_target (&thread_db_ops);
- using_thread_db = 0;
- }
+ if (fbsd_thread_present && !fbsd_thread_active)
+ push_target(&fbsd_thread_ops);
child_ops.to_create_inferior (exec_file, allargs, env);
}
@@ -690,31 +758,44 @@
static void
fbsd_thread_post_startup_inferior (ptid_t ptid)
{
- if (proc_handle.pid == 0)
+ if (fbsd_thread_present && !fbsd_thread_active)
{
- /*
- * The child process is now the actual multi-threaded
- * program. Snatch its process ID...
- */
+ /* The child process is now the actual multi-threaded
+ program. Snatch its process ID... */
proc_handle.pid = GET_PID (ptid);
-
- fbsd_thread_find_new_threads ();
- get_current_thread ();
+ td_ta_new_p (&proc_handle, &thread_agent);
+ fbsd_thread_activate();
}
}
static void
fbsd_thread_mourn_inferior (void)
{
- /*
- * Forget about the child's process ID. We shouldn't need it
- * anymore.
- */
- proc_handle.pid = 0;
+ if (fbsd_thread_active)
+ fbsd_thread_deactivate ();
+
+ unpush_target (&fbsd_thread_ops);
child_ops.to_mourn_inferior ();
}
+static void
+fbsd_core_check_lwp (bfd *abfd, asection *asect, void *obj)
+{
+ lwpid_t lwp;
+
+ if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
+ return;
+
+ /* already found */
+ if (*(lwpid_t *)obj == 0)
+ return;
+
+ lwp = atoi (bfd_section_name (abfd, asect) + 5);
+ if (*(lwpid_t *)obj == lwp)
+ *(lwpid_t *)obj = 0;
+}
+
static int
fbsd_thread_alive (ptid_t ptid)
{
@@ -722,6 +803,7 @@
td_thrinfo_t ti;
td_err_e err;
gregset_t gregs;
+ lwpid_t lwp;
if (IS_THREAD (ptid))
{
@@ -745,19 +827,35 @@
return 1;
}
- err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
+ if (fbsd_thread_active)
+ {
+ err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
+
+ /*
+ * if the lwp was already mapped to user thread, don't use it
+ * directly, please use user thread id instead.
+ */
+ if (err == TD_OK)
+ return 0;
+ }
- /*
- * if the lwp was already mapped to user thread, don't use it
- * directly, please use user thread id instead.
- */
- if (err == TD_OK)
- return 0;
+ if (!target_has_execution)
+ {
+ lwp = GET_LWP (ptid);
+ bfd_map_over_sections (core_bfd, fbsd_core_check_lwp, &lwp);
+ return (lwp == 0);
+ }
/* check lwp in kernel */
return ptrace (PT_GETREGS, GET_LWP (ptid), (caddr_t)&gregs, 0) == 0;
}
+static void
+fbsd_thread_files_info (struct target_ops *ignore)
+{
+ child_ops.to_files_info (ignore);
+}
+
static int
find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
{
@@ -773,11 +871,10 @@
if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
return 0;
- ptid = BUILD_THREAD (ti.ti_tid, GET_PID (inferior_ptid));
+ ptid = BUILD_THREAD (ti.ti_tid, proc_handle.pid);
if (!in_thread_list (ptid))
add_thread (ptid);
-
return 0;
}
@@ -786,6 +883,9 @@
{
td_err_e err;
+ if (!fbsd_thread_active)
+ return;
+
/* Iterate over all user-space threads to discover new threads. */
err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL,
TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
@@ -908,109 +1008,169 @@
static void
fbsd_thread_tsd_cmd (char *exp, int from_tty)
{
- td_ta_tsd_iter_p (thread_agent, tsd_cb, NULL);
+ if (fbsd_thread_active)
+ td_ta_tsd_iter_p (thread_agent, tsd_cb, NULL);
}
-static void
-init_thread_db_ops (void)
+static int
+ignore (CORE_ADDR addr, char *contents)
{
- thread_db_ops.to_shortname = "multi-thread";
- thread_db_ops.to_longname = "multi-threaded child process.";
- thread_db_ops.to_doc = "Threads and pthreads support.";
- thread_db_ops.to_attach = fbsd_thread_attach;
- thread_db_ops.to_detach = fbsd_thread_detach;
- thread_db_ops.to_resume = fbsd_thread_resume;
- thread_db_ops.to_wait = fbsd_thread_wait;
- thread_db_ops.to_fetch_registers = fbsd_thread_fetch_registers;
- thread_db_ops.to_store_registers = fbsd_thread_store_registers;
- thread_db_ops.to_xfer_memory = fbsd_thread_xfer_memory;
- thread_db_ops.to_kill = fbsd_thread_kill;
- thread_db_ops.to_create_inferior = fbsd_thread_create_inferior;
- thread_db_ops.to_post_startup_inferior = fbsd_thread_post_startup_inferior;
- thread_db_ops.to_mourn_inferior = fbsd_thread_mourn_inferior;
- thread_db_ops.to_thread_alive = fbsd_thread_alive;
- thread_db_ops.to_find_new_threads = fbsd_thread_find_new_threads;
- thread_db_ops.to_pid_to_str = fbsd_thread_pid_to_str;
- thread_db_ops.to_stratum = thread_stratum;
- thread_db_ops.to_has_thread_control = tc_none;
- thread_db_ops.to_insert_breakpoint = memory_insert_breakpoint;
- thread_db_ops.to_remove_breakpoint = memory_remove_breakpoint;
- thread_db_ops.to_get_thread_local_address = fbsd_thread_get_local_address;
- thread_db_ops.to_magic = OPS_MAGIC;
+ return 0;
}
-static int
-thread_db_load (void)
+static void
+fbsd_core_open (char *filename, int from_tty)
{
- void *handle;
- td_err_e err;
+ int err;
- handle = dlopen (LIBTHREAD_DB_SO, RTLD_NOW);
- if (handle == NULL)
- return 0;
+ fbsd_thread_core = 1;
- td_init_p = dlsym (handle, "td_init");
- if (td_init_p == NULL)
- return 0;
+ orig_core_ops.to_open (filename, from_tty);
- td_ta_new_p = dlsym (handle, "td_ta_new");
- if (td_ta_new_p == NULL)
- return 0;
+ if (fbsd_thread_present)
+ {
+ err = td_ta_new_p (&proc_handle, &thread_agent);
+ if (err == TD_OK)
+ {
+ proc_handle.pid = elf_tdata (core_bfd)->core_pid;
+ fbsd_thread_activate ();
+ }
+ else
+ error ("fbsd_core_open: td_ta_new: %s", thread_db_err_str (err));
+ }
+}
- td_ta_map_id2thr_p = dlsym (handle, "td_ta_map_id2thr");
- if (td_ta_map_id2thr_p == NULL)
- return 0;
+static void
+fbsd_core_close (int quitting)
+{
+ orig_core_ops.to_close (quitting);
+}
- td_ta_map_lwp2thr_p = dlsym (handle, "td_ta_map_lwp2thr");
- if (td_ta_map_lwp2thr_p == NULL)
- return 0;
+static void
+fbsd_core_detach (char *args, int from_tty)
+{
+ if (fbsd_thread_active)
+ fbsd_thread_deactivate ();
+ unpush_target (&fbsd_thread_ops);
+ orig_core_ops.to_detach (args, from_tty);
+
+ /* Clear gdb solib information and symbol file
+ cache, so that after detach and re-attach, new_objfile
+ hook will be called */
+ clear_solib();
+ symbol_file_clear(0);
+}
- td_ta_thr_iter_p = dlsym (handle, "td_ta_thr_iter");
- if (td_ta_thr_iter_p == NULL)
- return 0;
+static void
+fbsd_core_files_info (struct target_ops *ignore)
+{
+ orig_core_ops.to_files_info (ignore);
+}
- td_thr_validate_p = dlsym (handle, "td_thr_validate");
- if (td_thr_validate_p == NULL)
- return 0;
+static void
+init_fbsd_core_ops (void)
+{
+ fbsd_core_ops.to_shortname = "FreeBSD-core";
+ fbsd_core_ops.to_longname = "FreeBSD core thread.";
+ fbsd_core_ops.to_doc = "FreeBSD threads support for core files.";
+ fbsd_core_ops.to_open = fbsd_core_open;
+ fbsd_core_ops.to_close = fbsd_core_close;
+ fbsd_core_ops.to_attach = 0;
+ fbsd_core_ops.to_post_attach = 0;
+ fbsd_core_ops.to_detach = fbsd_core_detach;
+ /* fbsd_core_ops.to_resume = 0; */
+ /* fbsd_core_ops.to_wait = 0; */
+ fbsd_core_ops.to_fetch_registers = fbsd_thread_fetch_registers;
+ /* fbsd_core_ops.to_store_registers = 0; */
+ /* fbsd_core_ops.to_prepare_to_store = 0; */
+ fbsd_core_ops.to_xfer_memory = fbsd_thread_xfer_memory;
+ fbsd_core_ops.to_files_info = fbsd_core_files_info;
+ fbsd_core_ops.to_insert_breakpoint = ignore;
+ fbsd_core_ops.to_remove_breakpoint = ignore;
+ /* fbsd_core_ops.to_lookup_symbol = 0; */
+ fbsd_core_ops.to_create_inferior = fbsd_thread_create_inferior;
+ fbsd_core_ops.to_stratum = core_stratum;
+ fbsd_core_ops.to_has_all_memory = 0;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list