* sysdeps/unix/sysv/linux/opensock.c: Include <string.h>.
[glibc.git] / linuxthreads_db / thread_dbP.h
blob8e87bae52d88dd5fa2a388e9f24dfdc27468ef56
1 /* Private header for thread debug library. */
2 #ifndef _THREAD_DBP_H
3 #define _THREAD_DBP_H 1
5 #include <string.h>
6 #include "proc_service.h"
7 #include "thread_db.h"
8 #include "../linuxthreads/internals.h"
11 /* Indeces for the symbol names. */
12 enum
14 PTHREAD_THREADS_EVENTS = 0,
15 PTHREAD_LAST_EVENT,
16 PTHREAD_HANDLES_NUM,
17 PTHREAD_HANDLES,
18 PTHREAD_KEYS,
19 LINUXTHREADS_PTHREAD_THREADS_MAX,
20 LINUXTHREADS_PTHREAD_KEYS_MAX,
21 LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
22 LINUXTHREADS_CREATE_EVENT,
23 LINUXTHREADS_DEATH_EVENT,
24 LINUXTHREADS_REAP_EVENT,
25 NUM_MESSAGES
29 /* Comment out the following for less verbose output. */
30 #ifndef NDEBUG
31 # define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
32 extern int __td_debug;
33 #else
34 # define LOG(c)
35 #endif
38 /* Handle for a process. This type is opaque. */
39 struct td_thragent
41 /* Delivered by the debugger and we have to pass it back in the
42 proc callbacks. */
43 struct ps_prochandle *ph;
45 /* Some cached information. */
47 /* Address of the `__pthread_handles' array. */
48 struct pthread_handle_struct *handles;
50 /* Address of the `pthread_kyes' array. */
51 struct pthread_key_struct *keys;
53 /* Maximum number of threads. */
54 int pthread_threads_max;
56 /* Maximum number of thread-local data keys. */
57 int pthread_keys_max;
59 /* Size of 2nd level array for thread-local data keys. */
60 int pthread_key_2ndlevel_size;
62 /* Sizeof struct _pthread_descr_struct. */
63 int sizeof_descr;
65 /* Pointer to the `__pthread_threads_events' variable in the target. */
66 psaddr_t pthread_threads_eventsp;
68 /* Pointer to the `__pthread_last_event' variable in the target. */
69 psaddr_t pthread_last_event;
71 /* Pointer to the `__pthread_handles_num' variable. */
72 psaddr_t pthread_handles_num;
76 /* Type used internally to keep track of thread agent descriptors. */
77 struct agent_list
79 td_thragent_t *ta;
80 struct agent_list *next;
83 /* List of all known descriptors. */
84 extern struct agent_list *__td_agent_list;
86 /* Function used to test for correct thread agent pointer. */
87 static inline int
88 ta_ok (const td_thragent_t *ta)
90 struct agent_list *runp = __td_agent_list;
92 if (ta == NULL)
93 return 0;
95 while (runp != NULL && runp->ta != ta)
96 runp = runp->next;
98 return runp != NULL;
102 /* Internal wrapper around ps_pglobal_lookup. */
103 extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
105 #endif /* thread_dbP.h */