Deleted Added
sdiff udiff text old ( 163540 ) new ( 177490 )
full compact
1/*
2 * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libthread_db/thread_db.c 177490 2008-03-22 05:40:44Z davidxu $");
29
30#include <proc_service.h>
31#include <stddef.h>
32#include <thread_db.h>
33#include <unistd.h>
34#include <sys/cdefs.h>
35#include <sys/linker_set.h>
36
37#include "thread_db_int.h"
38
39struct td_thragent
40{
41 TD_THRAGENT_FIELDS;
42};
43
44static TAILQ_HEAD(, td_thragent) proclist = TAILQ_HEAD_INITIALIZER(proclist);
45
46SET_DECLARE(__ta_ops, struct ta_ops);
47
48td_err_e
49td_init(void)
50{
51 td_err_e ret, tmp;
52 struct ta_ops *ops_p, **ops_pp;
53 size_t i;
54
55 ret = 0;
56 SET_FOREACH(ops_pp, __ta_ops) {
57 ops_p = *ops_pp;
58 if (ops_p->to_init != NULL) {
59 tmp = ops_p->to_init();
60 if (tmp != TD_OK)
61 ret = tmp;
62 }
63 }
64 return (ret);
65}
66
67td_err_e

--- 32 unchanged lines hidden (view full) ---

100{
101 return (ta->ta_ops->to_ta_map_lwp2thr(ta, lwpid, th));
102}
103
104td_err_e
105td_ta_new(struct ps_prochandle *ph, td_thragent_t **pta)
106{
107 size_t i;
108 struct ta_ops *ops_p, **ops_pp;
109
110 SET_FOREACH(ops_pp, __ta_ops) {
111 ops_p = *ops_pp;
112 if (ops_p->to_ta_new(ph, pta) == TD_OK) {
113 TAILQ_INSERT_HEAD(&proclist, *pta, ta_next);
114 (*pta)->ta_ops = ops_p;
115 return (TD_OK);
116 }
117 }
118 return (TD_NOLIBTHREAD);
119}
120
121td_err_e
122td_ta_set_event(const td_thragent_t *ta, td_thr_events_t *events)

--- 139 unchanged lines hidden ---