PERFORCE change 75000 for review
Sam Leffler
sam at FreeBSD.org
Tue Apr 12 11:54:02 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=75000
Change 75000 by sam at sam_ebb on 2005/04/12 18:53:15
IFC @ 74999
Affected files ...
.. //depot/projects/wifi/contrib/traceroute/traceroute.8#2 integrate
.. //depot/projects/wifi/etc/defaults/rc.conf#13 integrate
.. //depot/projects/wifi/gnu/usr.bin/gdb/libgdb/fbsd-threads.c#5 integrate
.. //depot/projects/wifi/lib/libthr/Makefile#4 integrate
.. //depot/projects/wifi/lib/libthr/pthread.map#2 integrate
.. //depot/projects/wifi/lib/libthr/thread/Makefile.inc#3 integrate
.. //depot/projects/wifi/lib/libthr/thread/thr_create.c#3 integrate
.. //depot/projects/wifi/lib/libthr/thread/thr_event.c#1 branch
.. //depot/projects/wifi/lib/libthr/thread/thr_exit.c#3 integrate
.. //depot/projects/wifi/lib/libthr/thread/thr_init.c#5 integrate
.. //depot/projects/wifi/lib/libthr/thread/thr_list.c#2 integrate
.. //depot/projects/wifi/lib/libthr/thread/thr_private.h#5 integrate
.. //depot/projects/wifi/lib/libthr/thread/thr_symbols.c#2 integrate
.. //depot/projects/wifi/lib/libthread_db/libc_r_db.c#2 integrate
.. //depot/projects/wifi/lib/libthread_db/libpthread_db.c#3 integrate
.. //depot/projects/wifi/lib/libthread_db/libthr_db.c#3 integrate
.. //depot/projects/wifi/lib/libthread_db/thread_db.h#3 integrate
.. //depot/projects/wifi/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#13 integrate
.. //depot/projects/wifi/release/doc/share/misc/dev.archlist.txt#12 integrate
.. //depot/projects/wifi/share/misc/pci_vendors#2 integrate
.. //depot/projects/wifi/sys/dev/ata/ata-raid.c#4 integrate
.. //depot/projects/wifi/sys/dev/ata/ata-raid.h#3 integrate
.. //depot/projects/wifi/sys/dev/ath/if_ath.c#83 integrate
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#33 integrate
.. //depot/projects/wifi/sys/dev/pccard/pccard.c#7 integrate
.. //depot/projects/wifi/sys/dev/pccard/pccardvar.h#3 integrate
.. //depot/projects/wifi/sys/dev/usb/ucom.c#4 integrate
.. //depot/projects/wifi/sys/geom/geom_sunlabel.c#2 integrate
.. //depot/projects/wifi/sys/kern/kern_lock.c#10 integrate
.. //depot/projects/wifi/sys/kern/kern_shutdown.c#4 integrate
.. //depot/projects/wifi/sys/kern/subr_bus.c#13 integrate
.. //depot/projects/wifi/sys/kern/subr_rman.c#4 integrate
.. //depot/projects/wifi/sys/net80211/ieee80211_crypto.c#11 integrate
.. //depot/projects/wifi/sys/net80211/ieee80211_crypto.h#9 integrate
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#37 integrate
.. //depot/projects/wifi/sys/powerpc/psim/ata_iobus.c#6 integrate
.. //depot/projects/wifi/sys/sys/bus.h#8 integrate
.. //depot/projects/wifi/sys/sys/rman.h#4 integrate
.. //depot/projects/wifi/sys/sys/vnode.h#21 integrate
.. //depot/projects/wifi/tools/tools/README#4 integrate
.. //depot/projects/wifi/usr.bin/netstat/inet.c#4 integrate
.. //depot/projects/wifi/usr.sbin/sysinstall/config.c#5 integrate
.. //depot/projects/wifi/usr.sbin/yppush/yppush_main.c#2 integrate
Differences ...
==== //depot/projects/wifi/contrib/traceroute/traceroute.8#2 (text+ko) ====
@@ -14,7 +14,7 @@
.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" $Id: traceroute.8,v 1.19 2000/09/21 08:44:19 leres Exp $
-.\" $FreeBSD: src/contrib/traceroute/traceroute.8,v 1.10 2002/12/13 22:26:10 fenner Exp $
+.\" $FreeBSD: src/contrib/traceroute/traceroute.8,v 1.11 2005/04/12 15:16:32 thomas Exp $
.\"
.TH TRACEROUTE 8 "21 September 2000"
.UC 6
@@ -151,7 +151,7 @@
Traceroute hopes that nothing is listening on UDP ports
.I base
to
-.I base + nhops - 1
+.I base + nhops * nprobes - 1
at the destination host (so an ICMP PORT_UNREACHABLE message will
be returned to terminate the route tracing). If something is
listening on a port in the default range, this option can be used
==== //depot/projects/wifi/etc/defaults/rc.conf#13 (text+ko) ====
@@ -15,7 +15,7 @@
# For a more detailed explanation of all the rc.conf variables, please
# refer to the rc.conf(5) manual page.
#
-# $FreeBSD: src/etc/defaults/rc.conf,v 1.246 2005/04/11 02:45:05 dougb Exp $
+# $FreeBSD: src/etc/defaults/rc.conf,v 1.247 2005/04/12 15:21:51 thomas Exp $
##############################################################
### Important initial Boot-time options ####################
@@ -436,7 +436,7 @@
chkprintcap_flags="-d" # Create missing directories by default.
usbd_enable="NO" # Run the usbd daemon.
usbd_flags="" # Flags to usbd (if enabled).
-dumpdev="NO" # Device name to crashdump to (or NO).
+dumpdev="NO" # Device to crashdump to (device name, AUTO, or NO).
dumpdir="/var/crash" # Directory where crash dumps are to be stored
savecore_flags="" # Used if dumpdev is enabled above, and present.
enable_quotas="NO" # turn on quotas on startup (or NO).
==== //depot/projects/wifi/gnu/usr.bin/gdb/libgdb/fbsd-threads.c#5 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c,v 1.10 2005/04/05 11:40:58 davidxu Exp $ */
+/* $FreeBSD: src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c,v 1.11 2005/04/12 03:04:04 davidxu Exp $ */
/* FreeBSD libthread_db assisted debugging support.
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -130,9 +130,17 @@
static td_err_e (*td_thr_dbsuspend_p) (const td_thrhandle_t *);
static td_err_e (*td_thr_dbresume_p) (const td_thrhandle_t *);
+static CORE_ADDR td_create_bp_addr;
+
+/* Location of the thread death event breakpoint. */
+static CORE_ADDR td_death_bp_addr;
+
/* Prototypes for local functions. */
static void fbsd_thread_find_new_threads (void);
static int fbsd_thread_alive (ptid_t ptid);
+static void attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
+ const td_thrinfo_t *ti_p, int verbose);
+static void fbsd_thread_detach (char *args, int from_tty);
/* Building process ids. */
@@ -228,23 +236,21 @@
/* Convert LWP to user-level thread id. */
static ptid_t
-thread_from_lwp (ptid_t ptid)
+thread_from_lwp (ptid_t ptid, td_thrhandle_t *th, td_thrinfo_t *ti)
{
- td_thrinfo_t ti;
- td_thrhandle_t th;
td_err_e err;
gdb_assert (IS_LWP (ptid));
if (fbsd_thread_active)
{
- err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
+ err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), th);
if (err == TD_OK)
{
- err = td_thr_get_info_p (&th, &ti);
+ 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));
+ return BUILD_THREAD (ti->ti_tid, GET_PID (ptid));
}
}
@@ -285,24 +291,114 @@
static void
get_current_thread ()
{
+ td_thrhandle_t th;
+ td_thrinfo_t ti;
long lwp;
ptid_t tmp, ptid;
lwp = get_current_lwp (proc_handle.pid);
tmp = BUILD_LWP (lwp, proc_handle.pid);
- ptid = thread_from_lwp (tmp);
+ ptid = thread_from_lwp (tmp, &th, &ti);
if (!in_thread_list (ptid))
{
- add_thread (ptid);
+ attach_thread (ptid, &th, &ti, 1);
}
inferior_ptid = ptid;
}
+static td_err_e
+enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp)
+{
+ td_notify_t notify;
+ td_err_e err;
+
+ /* Get the breakpoint address for thread EVENT. */
+ err = td_ta_event_addr_p (thread_agent, event, ¬ify);
+ if (err != TD_OK)
+ return err;
+
+ /* Set up the breakpoint. */
+ (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ (CORE_ADDR)notify.u.bptaddr,
+ ¤t_target);
+ create_thread_event_breakpoint ((*bp));
+
+ return TD_OK;
+}
+
+static void
+enable_thread_event_reporting (void)
+{
+ td_thr_events_t events;
+ td_notify_t notify;
+ td_err_e err;
+
+ /* We cannot use the thread event reporting facility if these
+ functions aren't available. */
+ if (td_ta_event_addr_p == NULL || td_ta_set_event_p == NULL
+ || td_ta_event_getmsg_p == NULL || td_thr_event_enable_p == NULL)
+ return;
+
+ /* Set the process wide mask saying which events we're interested in. */
+ td_event_emptyset (&events);
+ td_event_addset (&events, TD_CREATE);
+ td_event_addset (&events, TD_DEATH);
+
+ err = td_ta_set_event_p (thread_agent, &events);
+ if (err != TD_OK)
+ {
+ warning ("Unable to set global thread event mask: %s",
+ thread_db_err_str (err));
+ return;
+ }
+
+ /* Delete previous thread event breakpoints, if any. */
+ remove_thread_event_breakpoints ();
+ td_create_bp_addr = 0;
+ td_death_bp_addr = 0;
+
+ /* Set up the thread creation event. */
+ err = enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr);
+ if (err != TD_OK)
+ {
+ warning ("Unable to get location for thread creation breakpoint: %s",
+ thread_db_err_str (err));
+ return;
+ }
+
+ /* Set up the thread death event. */
+ err = enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr);
+ if (err != TD_OK)
+ {
+ warning ("Unable to get location for thread death breakpoint: %s",
+ thread_db_err_str (err));
+ return;
+ }
+}
+
+static void
+disable_thread_event_reporting (void)
+{
+ td_thr_events_t events;
+
+ /* Set the process wide mask saying we aren't interested in any
+ events anymore. */
+ td_event_emptyset (&events);
+ td_ta_set_event_p (thread_agent, &events);
+
+ /* Delete thread event breakpoints, if any. */
+ remove_thread_event_breakpoints ();
+ td_create_bp_addr = 0;
+ td_death_bp_addr = 0;
+}
+
static void
fbsd_thread_activate (void)
{
fbsd_thread_active = 1;
init_thread_list();
+ if (fbsd_thread_core == 0)
+ enable_thread_event_reporting ();
fbsd_thread_find_new_threads ();
get_current_thread ();
}
@@ -310,6 +406,8 @@
static void
fbsd_thread_deactivate (void)
{
+ if (fbsd_thread_core == 0)
+ disable_thread_event_reporting();
td_ta_delete_p (thread_agent);
inferior_ptid = pid_to_ptid (proc_handle.pid);
@@ -544,20 +642,111 @@
perror_with_name ("PT_CONTINUE");
}
+static void
+attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
+ const td_thrinfo_t *ti_p, int verbose)
+{
+ td_err_e err;
+
+ /* Add the thread to GDB's thread list. */
+ if (!in_thread_list (ptid)) {
+ add_thread (ptid);
+ if (verbose)
+ printf_unfiltered ("[New %s]\n", target_pid_to_str (ptid));
+ }
+
+ if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE)
+ return; /* A zombie thread -- do not attach. */
+
+ if (! IS_THREAD(ptid))
+ return;
+ /* Enable thread event reporting for this thread. */
+ err = td_thr_event_enable_p (th_p, 1);
+ if (err != TD_OK)
+ error ("Cannot enable thread event reporting for %s: %s",
+ target_pid_to_str (ptid), thread_db_err_str (err));
+}
+
+static void
+detach_thread (ptid_t ptid, int verbose)
+{
+ if (verbose)
+ printf_unfiltered ("[%s exited]\n", target_pid_to_str (ptid));
+}
+
+static void
+check_event (ptid_t ptid)
+{
+ td_event_msg_t msg;
+ td_thrinfo_t ti;
+ td_err_e err;
+ CORE_ADDR stop_pc;
+ int loop = 0;
+
+ /* Bail out early if we're not at a thread event breakpoint. */
+ stop_pc = read_pc_pid (ptid) - DECR_PC_AFTER_BREAK;
+ if (stop_pc != td_create_bp_addr && stop_pc != td_death_bp_addr)
+ return;
+ loop = 1;
+
+ do
+ {
+ err = td_ta_event_getmsg_p (thread_agent, &msg);
+ if (err != TD_OK)
+ {
+ if (err == TD_NOMSG)
+ return;
+ error ("Cannot get thread event message: %s",
+ thread_db_err_str (err));
+ }
+ err = td_thr_get_info_p (msg.th_p, &ti);
+ if (err != TD_OK)
+ error ("Cannot get thread info: %s", thread_db_err_str (err));
+ ptid = BUILD_THREAD (ti.ti_tid, GET_PID (ptid));
+ switch (msg.event)
+ {
+ case TD_CREATE:
+ /* 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. */
+ attach_thread (ptid, msg.th_p, &ti, 1);
+ break;
+ case TD_DEATH:
+ if (!in_thread_list (ptid))
+ error ("Spurious thread death event.");
+ detach_thread (ptid, 1);
+ break;
+ default:
+ error ("Spurious thread event.");
+ }
+ }
+ while (loop);
+}
+
static ptid_t
fbsd_thread_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
ptid_t ret;
long lwp;
CORE_ADDR stop_pc;
+ td_thrhandle_t th;
+ td_thrinfo_t ti;
ret = child_ops.to_wait (ptid, ourstatus);
if (GET_PID(ret) >= 0 && ourstatus->kind == TARGET_WAITKIND_STOPPED)
{
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);
+ ret = thread_from_lwp (BUILD_LWP(lwp, GET_PID(ret)),
+ &th, &ti);
+ if (!in_thread_list(ret)) {
+ /*
+ * We have to enable event reporting for initial thread
+ * which was not mapped before.
+ */
+ attach_thread(ret, &th, &ti, 1);
+ }
+ if (ourstatus->value.sig == TARGET_SIGNAL_TRAP)
+ check_event(ret);
/* this is a hack, if an event won't cause gdb to stop, for example,
SIGARLM, gdb resumes the process immediatly without setting
inferior_ptid to the new thread returned here, this is a bug
@@ -567,7 +756,7 @@
{
delete_thread (inferior_ptid);
inferior_ptid = ret;
- }
+ }
}
return (ret);
@@ -873,9 +1062,7 @@
return 0;
ptid = BUILD_THREAD (ti.ti_tid, proc_handle.pid);
-
- if (!in_thread_list (ptid))
- add_thread (ptid);
+ attach_thread (ptid, th_p, &ti, 1);
return 0;
}
@@ -968,7 +1155,7 @@
ret = td_ta_map_id2thr_p (thread_agent, GET_THREAD(ptid), &th);
/* get the address of the variable. */
- ret = td_thr_tls_get_addr_p (&th, (void *) lm, offset, &address);
+ ret = td_thr_tls_get_addr_p (&th, (void *)lm, offset, &address);
if (ret != TD_OK)
{
@@ -1180,6 +1367,13 @@
return 0;
}
+ /* These are not essential. */
+ td_ta_event_addr_p = dlsym (handle, "td_ta_event_addr");
+ td_ta_set_event_p = dlsym (handle, "td_ta_set_event");
+ td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg");
+ td_thr_event_enable_p = dlsym (handle, "td_thr_event_enable");
+ td_thr_tls_get_addr_p = dlsym (handle, "td_thr_tls_get_addr");
+
return 1;
}
==== //depot/projects/wifi/lib/libthr/Makefile#4 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libthr/Makefile,v 1.10 2005/04/06 13:48:11 davidxu Exp $
+# $FreeBSD: src/lib/libthr/Makefile,v 1.11 2005/04/12 03:00:28 davidxu Exp $
#
# All library objects contain FreeBSD revision strings by default; they may be
# excluded as a space-saving measure. To produce a library that does
@@ -16,6 +16,7 @@
CFLAGS+=-I${.CURDIR}/sys
CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf
CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH}
+CFLAGS+=-I${.CURDIR}/../libthread_db
CFLAGS+=-Winline
# CFLAGS+=-DSYSTEM_SCOPE_ONLY
==== //depot/projects/wifi/lib/libthr/pthread.map#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libthr/pthread.map,v 1.2 2005/04/03 23:52:29 davidxu Exp $
+# $FreeBSD: src/lib/libthr/pthread.map,v 1.3 2005/04/12 03:00:28 davidxu Exp $
LIBPTHREAD_1_0 {
global:
___creat;
@@ -344,21 +344,26 @@
# Debugger needs these.
_libthr_debug;
_thread_active_threads;
+ _thread_bp_create;
+ _thread_bp_death;
+ _thread_event_mask;
_thread_keytable;
+ _thread_last_event;
_thread_list;
_thread_max_keys;
_thread_off_attr_flags;
_thread_off_dtv;
+ _thread_off_event_buf;
+ _thread_off_event_mask;
+ _thread_off_key_allocated;
+ _thread_off_key_destructor;
_thread_off_linkmap;
_thread_off_next;
+ _thread_off_report_events;
+ _thread_off_state;
_thread_off_tcb;
_thread_off_tid;
- _thread_off_key_allocated;
- _thread_off_key_destructor;
- _thread_off_state;
- _thread_off_thr_locklevel;
_thread_off_tlsindex;
- _thread_off_isdead;
_thread_size_key;
_thread_state_running;
_thread_state_zoombie;
==== //depot/projects/wifi/lib/libthr/thread/Makefile.inc#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libthr/thread/Makefile.inc,v 1.9 2005/04/02 01:20:00 davidxu Exp $
+# $FreeBSD: src/lib/libthr/thread/Makefile.inc,v 1.10 2005/04/12 03:00:28 davidxu Exp $
# thr sources
.PATH: ${.CURDIR}/thread
@@ -15,6 +15,7 @@
thr_create.c \
thr_detach.c \
thr_equal.c \
+ thr_event.c \
thr_exit.c \
thr_fork.c \
thr_getprio.c \
==== //depot/projects/wifi/lib/libthr/thread/thr_create.c#3 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_create.c,v 1.20 2005/04/02 01:20:00 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_create.c,v 1.21 2005/04/12 03:00:28 davidxu Exp $
*/
#include <errno.h>
@@ -56,7 +56,7 @@
ucontext_t uc;
sigset_t sigmask, oldsigmask;
struct pthread *curthread, *new_thread;
- int ret = 0;
+ int ret = 0, locked;
_thr_check_init();
@@ -92,9 +92,10 @@
else if (_thr_scope_system < 0)
new_thread->attr.flags &= ~PTHREAD_SCOPE_SYSTEM;
+ new_thread->tid = TID_TERMINATED;
+
if (create_stack(&new_thread->attr) != 0) {
/* Insufficient memory to create a stack: */
- new_thread->terminated = 1;
_thr_free(curthread, new_thread);
return (EAGAIN);
}
@@ -151,20 +152,31 @@
* it can not handle signal, so we should masks all signals here.
*/
SIGFILLSET(sigmask);
+ SIGDELSET(sigmask, SIGTRAP);
__sys_sigprocmask(SIG_SETMASK, &sigmask, &oldsigmask);
new_thread->sigmask = oldsigmask;
/* Add the new thread. */
_thr_link(curthread, new_thread);
/* Return thread pointer eariler so that new thread can use it. */
(*thread) = new_thread;
+ if (SHOULD_REPORT_EVENT(curthread, TD_CREATE)) {
+ THR_THREAD_LOCK(curthread, new_thread);
+ locked = 1;
+ } else
+ locked = 0;
/* Schedule the new thread. */
ret = thr_create(&uc, &new_thread->tid, 0);
__sys_sigprocmask(SIG_SETMASK, &oldsigmask, NULL);
if (ret != 0) {
+ if (locked)
+ THR_THREAD_UNLOCK(curthread, new_thread);
_thr_unlink(curthread, new_thread);
free_thread(curthread, new_thread);
(*thread) = 0;
ret = EAGAIN;
+ } else if (locked) {
+ _thr_report_creation(curthread, new_thread);
+ THR_THREAD_UNLOCK(curthread, new_thread);
}
return (ret);
}
@@ -173,7 +185,7 @@
free_thread(struct pthread *curthread, struct pthread *thread)
{
free_stack(curthread, &thread->attr);
- curthread->terminated = 1;
+ curthread->tid = TID_TERMINATED;
_thr_free(curthread, thread);
}
@@ -215,6 +227,9 @@
if (curthread->flags & THR_FLAGS_NEED_SUSPEND)
_thr_suspend_check(curthread);
+ THR_LOCK(curthread);
+ THR_UNLOCK(curthread);
+
/* Run the current thread's start routine with argument: */
pthread_exit(curthread->start_routine(curthread->arg));
==== //depot/projects/wifi/lib/libthr/thread/thr_exit.c#3 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_exit.c,v 1.17 2005/04/02 01:20:00 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_exit.c,v 1.18 2005/04/12 03:00:28 davidxu Exp $
*/
#include <errno.h>
@@ -130,7 +130,9 @@
THREAD_LIST_UNLOCK(curthread);
if (curthread->joiner)
_thr_umtx_wake(&curthread->state, INT_MAX);
- thr_exit(&curthread->terminated);
+ if (SHOULD_REPORT_EVENT(curthread, TD_DEATH))
+ _thr_report_death(curthread);
+ thr_exit(&curthread->tid);
PANIC("thr_exit() returned");
/* Never reach! */
}
==== //depot/projects/wifi/lib/libthr/thread/thr_init.c#5 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_init.c,v 1.21 2005/04/06 13:57:31 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_init.c,v 1.23 2005/04/12 03:13:49 davidxu Exp $
*/
/* Allocate space for global thread variables here: */
@@ -309,6 +309,8 @@
_thr_initial = curthread;
SIGDELSET(oldset, SIGCANCEL);
__sys_sigprocmask(SIG_SETMASK, &oldset, NULL);
+ if (_thread_event_mask & TD_CREATE)
+ _thr_report_creation(curthread, curthread);
}
}
@@ -384,6 +386,7 @@
_thr_umtx_init(&_rwlock_static_lock);
_thr_umtx_init(&_keytable_lock);
_thr_umtx_init(&_thr_atfork_lock);
+ _thr_umtx_init(&_thr_event_lock);
_thr_spinlock_init();
_thr_list_init();
==== //depot/projects/wifi/lib/libthr/thread/thr_list.c#2 (text+ko) ====
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_list.c,v 1.3 2005/04/07 06:09:17 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_list.c,v 1.4 2005/04/12 03:00:28 davidxu Exp $
*/
#include <sys/types.h>
@@ -99,7 +99,7 @@
/* Check the threads waiting for GC. */
for (td = TAILQ_FIRST(&_thread_gc_list); td != NULL; td = td_next) {
td_next = TAILQ_NEXT(td, gcle);
- if (td->terminated == 0) {
+ if (td->tid != TID_TERMINATED) {
/* make sure we are not still in userland */
continue;
}
==== //depot/projects/wifi/lib/libthr/thread/thr_private.h#5 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_private.h,v 1.45 2005/04/06 13:57:31 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_private.h,v 1.46 2005/04/12 03:00:28 davidxu Exp $
*/
#ifndef _THR_PRIVATE_H
@@ -56,6 +56,7 @@
#include "pthread_md.h"
#include "thr_umtx.h"
+#include "thread_db.h"
/*
* Evaluate the storage class specifier.
@@ -345,11 +346,9 @@
*/
umtx_t lock;
- /* Thread is terminated in kernel, written by kernel. */
- long terminated;
-
/* Kernel thread id. */
long tid;
+#define TID_TERMINATED 1
/* Internal condition variable cycle number. */
umtx_t cycle;
@@ -491,6 +490,15 @@
/* Cleanup handlers Link List */
struct pthread_cleanup *cleanup;
+
+ /* Enable event reporting */
+ int report_events;
+
+ /* Event mask */
+ int event_mask;
+
+ /* Event */
+ td_event_msg_t event_buf;
};
#define THR_UMTX_TRYLOCK(thrd, lck) \
@@ -573,6 +581,10 @@
#define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
+#define SHOULD_REPORT_EVENT(curthr, e) \
+ (curthr->report_events && \
+ (((curthr)->event_mask | _thread_event_mask ) & e) != 0)
+
extern int __isthreaded;
/*
@@ -581,9 +593,12 @@
SCLASS void *_usrstack SCLASS_PRESET(NULL);
SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL);
+SCLASS int _thr_scope_system SCLASS_PRESET(0);
+
/* For debugger */
SCLASS int _libthr_debug SCLASS_PRESET(0);
-SCLASS int _thr_scope_system SCLASS_PRESET(0);
+SCLASS int _thread_event_mask SCLASS_PRESET(0);
+SCLASS struct pthread *_thread_last_event;
/* List of all threads: */
SCLASS TAILQ_HEAD(, pthread) _thread_list
@@ -643,6 +658,7 @@
SCLASS umtx_t _rwlock_static_lock;
SCLASS umtx_t _keytable_lock;
SCLASS umtx_t _thr_list_lock;
+SCLASS umtx_t _thr_event_lock;
/* Undefine the storage class and preset specifiers: */
#undef SCLASS
@@ -720,6 +736,11 @@
void _thr_unlink(struct pthread *curthread, struct pthread *thread);
void _thr_suspend_check(struct pthread *curthread);
void _thr_assert_lock_level() __dead2;
+void _thr_report_creation(struct pthread *curthread,
+ struct pthread *newthread);
+void _thr_report_death(struct pthread *curthread);
+void _thread_bp_create(void);
+void _thread_bp_death(void);
/* #include <sys/aio.h> */
#ifdef _SYS_AIO_H_
==== //depot/projects/wifi/lib/libthr/thread/thr_symbols.c#2 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_symbols.c,v 1.1 2005/04/02 01:20:00 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_symbols.c,v 1.2 2005/04/12 03:00:28 davidxu Exp $
*/
#include <stddef.h>
@@ -45,10 +45,11 @@
int _thread_off_tid = offsetof(struct pthread, tid);
int _thread_off_next = offsetof(struct pthread, tle.tqe_next);
int _thread_off_attr_flags = offsetof(struct pthread, attr.flags);
-int _thread_off_thr_locklevel = offsetof(struct pthread, locklevel);
int _thread_off_linkmap = offsetof(Obj_Entry, linkmap);
int _thread_off_tlsindex = offsetof(Obj_Entry, tlsindex);
-int _thread_off_isdead = offsetof(struct pthread, terminated);
+int _thread_off_report_events = offsetof(struct pthread, report_events);
+int _thread_off_event_mask = offsetof(struct pthread, event_mask);
+int _thread_off_event_buf = offsetof(struct pthread, event_buf);
int _thread_size_key = sizeof(struct pthread_key);
int _thread_off_key_allocated = offsetof(struct pthread_key, allocated);
int _thread_off_key_destructor = offsetof(struct pthread_key, destructor);
==== //depot/projects/wifi/lib/libthread_db/libc_r_db.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libthread_db/libc_r_db.c,v 1.1 2004/07/18 04:17:13 marcel Exp $");
+__FBSDID("$FreeBSD: src/lib/libthread_db/libc_r_db.c,v 1.2 2005/04/12 03:03:16 davidxu Exp $");
#include <machine/setjmp.h>
#include <proc_service.h>
@@ -58,7 +58,7 @@
static td_err_e
libc_r_db_ta_clear_event(const td_thragent_t *ta, td_thr_events_t *ev)
{
- return (TD_ERR);
+ return (0);
}
static td_err_e
@@ -160,7 +160,7 @@
static td_err_e
libc_r_db_ta_set_event(const td_thragent_t *ta, td_thr_events_t *ev)
{
- return (TD_ERR);
+ return (0);
}
static td_err_e
@@ -192,13 +192,13 @@
static td_err_e
libc_r_db_thr_clear_event(const td_thrhandle_t *th, td_thr_events_t *ev)
{
- return (TD_ERR);
+ return (0);
}
static td_err_e
libc_r_db_thr_event_enable(const td_thrhandle_t *th, int oo)
{
- return (TD_ERR);
+ return (0);
}
static td_err_e
@@ -281,7 +281,7 @@
static td_err_e
libc_r_db_thr_set_event(const td_thrhandle_t *th, td_thr_events_t *ev)
{
- return (TD_ERR);
+ return (0);
}
static td_err_e
==== //depot/projects/wifi/lib/libthread_db/libpthread_db.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libthread_db/libpthread_db.c,v 1.7 2005/04/05 11:38:30 davidxu Exp $");
+__FBSDID("$FreeBSD: src/lib/libthread_db/libpthread_db.c,v 1.8 2005/04/12 03:03:16 davidxu Exp $");
#include <stddef.h>
#include <stdlib.h>
@@ -428,21 +428,21 @@
pt_ta_event_addr(const td_thragent_t *ta, td_event_e event, td_notify_t *ptr)
{
TDBG_FUNC();
- return (TD_NOEVENT);
+ return (TD_ERR);
}
static td_err_e
pt_ta_set_event(const td_thragent_t *ta, td_thr_events_t *events)
{
TDBG_FUNC();
- return (TD_ERR);
+ return (0);
}
static td_err_e
pt_ta_clear_event(const td_thragent_t *ta, td_thr_events_t *events)
{
TDBG_FUNC();
- return (TD_ERR);
+ return (0);
}
static td_err_e
@@ -821,21 +821,21 @@
pt_thr_event_enable(const td_thrhandle_t *th, int en)
{
TDBG_FUNC();
- return (TD_ERR);
+ return (0);
}
static td_err_e
pt_thr_set_event(const td_thrhandle_t *th, td_thr_events_t *setp)
{
TDBG_FUNC();
- return (TD_ERR);
+ return (0);
}
static td_err_e
pt_thr_clear_event(const td_thrhandle_t *th, td_thr_events_t *setp)
{
TDBG_FUNC();
- return (TD_ERR);
+ return (0);
}
static td_err_e
==== //depot/projects/wifi/lib/libthread_db/libthr_db.c#3 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libthread_db/libthr_db.c,v 1.4 2005/04/05 11:38:30 davidxu Exp $");
+__FBSDID("$FreeBSD: src/lib/libthread_db/libthr_db.c,v 1.5 2005/04/12 03:03:16 davidxu Exp $");
#include <proc_service.h>
#include <stddef.h>
@@ -39,6 +39,8 @@
#include "thread_db_int.h"
+#define TERMINATED 1
+
struct pt_map {
int used;
lwpid_t lwp;
@@ -49,24 +51,27 @@
TD_THRAGENT_FIELDS;
psaddr_t libthr_debug_addr;
psaddr_t thread_list_addr;
- psaddr_t thread_listgen_addr;
psaddr_t thread_active_threads_addr;
psaddr_t thread_keytable_addr;
- int thread_inited;
+ psaddr_t thread_last_event_addr;
+ psaddr_t thread_event_mask_addr;
+ psaddr_t thread_bp_create_addr;
+ psaddr_t thread_bp_death_addr;
int thread_off_dtv;
int thread_off_tlsindex;
int thread_off_attr_flags;
int thread_size_key;
int thread_off_tcb;
int thread_off_linkmap;
- int thread_off_thr_locklevel;
int thread_off_next;
int thread_off_state;
- int thread_off_isdead;
int thread_off_tid;
int thread_max_keys;
int thread_off_key_allocated;
int thread_off_key_destructor;
+ int thread_off_report_events;
+ int thread_off_event_mask;
+ int thread_off_event_buf;
int thread_state_zoombie;
int thread_state_running;
struct pt_map *map;
@@ -131,7 +136,7 @@
sizeof(struct pt_map) * ta->map_len * 2);
if (new == NULL)
return (-1);
- memset(new + ta->map_len, '\0', sizeof(struct pt_map) *
+ memset(new + ta->map_len, 0, sizeof(struct pt_map) *
ta->map_len);
first = ta->map_len;
ta->map = new;
@@ -195,6 +200,10 @@
LOOKUP_SYM(ph, "_thread_list", &ta->thread_list_addr);
LOOKUP_SYM(ph, "_thread_active_threads",&ta->thread_active_threads_addr);
LOOKUP_SYM(ph, "_thread_keytable", &ta->thread_keytable_addr);
+ LOOKUP_SYM(ph, "_thread_last_event", &ta->thread_last_event_addr);
+ LOOKUP_SYM(ph, "_thread_event_mask", &ta->thread_event_mask_addr);
+ LOOKUP_SYM(ph, "_thread_bp_create", &ta->thread_bp_create_addr);
+ LOOKUP_SYM(ph, "_thread_bp_death", &ta->thread_bp_death_addr);
LOOKUP_VAL(ph, "_thread_off_dtv", &ta->thread_off_dtv);
LOOKUP_VAL(ph, "_thread_off_tlsindex", &ta->thread_off_tlsindex);
LOOKUP_VAL(ph, "_thread_off_attr_flags", &ta->thread_off_attr_flags);
@@ -202,15 +211,16 @@
LOOKUP_VAL(ph, "_thread_off_tcb", &ta->thread_off_tcb);
LOOKUP_VAL(ph, "_thread_off_tid", &ta->thread_off_tid);
LOOKUP_VAL(ph, "_thread_off_linkmap", &ta->thread_off_linkmap);
- LOOKUP_VAL(ph, "_thread_off_thr_locklevel", &ta->thread_off_thr_locklevel);
LOOKUP_VAL(ph, "_thread_off_next", &ta->thread_off_next);
LOOKUP_VAL(ph, "_thread_off_state", &ta->thread_off_state);
- LOOKUP_VAL(ph, "_thread_off_isdead", &ta->thread_off_isdead);
LOOKUP_VAL(ph, "_thread_max_keys", &ta->thread_max_keys);
LOOKUP_VAL(ph, "_thread_off_key_allocated", &ta->thread_off_key_allocated);
LOOKUP_VAL(ph, "_thread_off_key_destructor", &ta->thread_off_key_destructor);
LOOKUP_VAL(ph, "_thread_state_running", &ta->thread_state_running);
LOOKUP_VAL(ph, "_thread_state_zoombie", &ta->thread_state_zoombie);
+ LOOKUP_VAL(ph, "_thread_off_report_events", &ta->thread_off_report_events);
+ LOOKUP_VAL(ph, "_thread_off_event_mask", &ta->thread_off_event_mask);
+ LOOKUP_VAL(ph, "_thread_off_event_buf", &ta->thread_off_event_buf);
dbg = getpid();
/*
* If this fails it probably means we're debugging a core file and
@@ -250,7 +260,8 @@
prgregset_t gregs;
TAILQ_HEAD(, pthread) thread_list;
psaddr_t pt;
- int ret, isdead;
+ int ret;
+ long lwp;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list