From owner-svn-src-all@FreeBSD.ORG Wed Feb 25 20:56:28 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2225B106566B; Wed, 25 Feb 2009 20:56:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EF0C8FC12; Wed, 25 Feb 2009 20:56:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1PKuRph007811; Wed, 25 Feb 2009 20:56:27 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1PKuRhk007807; Wed, 25 Feb 2009 20:56:27 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200902252056.n1PKuRhk007807@svn.freebsd.org> From: Ed Maste Date: Wed, 25 Feb 2009 20:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189056 - stable/7/lib/libthread_db X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2009 20:56:28 -0000 Author: emaste Date: Wed Feb 25 20:56:27 2009 New Revision: 189056 URL: http://svn.freebsd.org/changeset/base/189056 Log: MFC r177490 - diff reduction w/ head. Use linker set to collection all target operations. Modified: stable/7/lib/libthread_db/ (props changed) stable/7/lib/libthread_db/libc_r_db.c stable/7/lib/libthread_db/libpthread_db.c stable/7/lib/libthread_db/libthr_db.c stable/7/lib/libthread_db/thread_db.c Modified: stable/7/lib/libthread_db/libc_r_db.c ============================================================================== --- stable/7/lib/libthread_db/libc_r_db.c Wed Feb 25 20:26:48 2009 (r189055) +++ stable/7/lib/libthread_db/libc_r_db.c Wed Feb 25 20:56:27 2009 (r189056) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -346,3 +347,5 @@ struct ta_ops libc_r_db_ops = { .to_thr_setxmmregs = libc_r_db_thr_setxmmregs, #endif }; + +DATA_SET(__ta_ops, libc_r_db_ops); Modified: stable/7/lib/libthread_db/libpthread_db.c ============================================================================== --- stable/7/lib/libthread_db/libpthread_db.c Wed Feb 25 20:26:48 2009 (r189055) +++ stable/7/lib/libthread_db/libpthread_db.c Wed Feb 25 20:56:27 2009 (r189056) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1147,3 +1148,5 @@ struct ta_ops libpthread_db_ops = { .to_thr_setxmmregs = pt_thr_setxmmregs, #endif }; + +DATA_SET(__ta_ops, libpthread_db_ops); Modified: stable/7/lib/libthread_db/libthr_db.c ============================================================================== --- stable/7/lib/libthread_db/libthr_db.c Wed Feb 25 20:26:48 2009 (r189055) +++ stable/7/lib/libthread_db/libthr_db.c Wed Feb 25 20:56:27 2009 (r189056) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -791,3 +792,5 @@ struct ta_ops libthr_db_ops = { .to_thr_setxmmregs = pt_thr_setxmmregs, #endif }; + +DATA_SET(__ta_ops, libthr_db_ops); Modified: stable/7/lib/libthread_db/thread_db.c ============================================================================== --- stable/7/lib/libthread_db/thread_db.c Wed Feb 25 20:26:48 2009 (r189055) +++ stable/7/lib/libthread_db/thread_db.c Wed Feb 25 20:56:27 2009 (r189056) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "thread_db_int.h" @@ -41,24 +43,20 @@ struct td_thragent static TAILQ_HEAD(, td_thragent) proclist = TAILQ_HEAD_INITIALIZER(proclist); -extern struct ta_ops libpthread_db_ops; -extern struct ta_ops libthr_db_ops; - -static struct ta_ops *ops[] = { - &libpthread_db_ops, - &libthr_db_ops, -}; +SET_DECLARE(__ta_ops, struct ta_ops); td_err_e td_init(void) { td_err_e ret, tmp; + struct ta_ops *ops_p, **ops_pp; size_t i; ret = 0; - for (i = 0; i < sizeof(ops)/sizeof(ops[0]); i++) { - if (ops[i]->to_init != NULL) { - tmp = ops[i]->to_init(); + SET_FOREACH(ops_pp, __ta_ops) { + ops_p = *ops_pp; + if (ops_p->to_init != NULL) { + tmp = ops_p->to_init(); if (tmp != TD_OK) ret = tmp; } @@ -107,11 +105,13 @@ td_err_e td_ta_new(struct ps_prochandle *ph, td_thragent_t **pta) { size_t i; + struct ta_ops *ops_p, **ops_pp; - for (i = 0; i < sizeof(ops)/sizeof(ops[0]); ++i) { - if (ops[i]->to_ta_new(ph, pta) == TD_OK) { + SET_FOREACH(ops_pp, __ta_ops) { + ops_p = *ops_pp; + if (ops_p->to_ta_new(ph, pta) == TD_OK) { TAILQ_INSERT_HEAD(&proclist, *pta, ta_next); - (*pta)->ta_ops = ops[i]; + (*pta)->ta_ops = ops_p; return (TD_OK); } }