fix regression from a745c4bfc8a9b5db4e48387170da0dc1d39e3abe
[uclibc-ng.git] / libpthread / linuxthreads_db / thread_dbP.h
blob64fd2e51168d3932070ef3755087c1a1dcb6104d
1 /* Private header for thread debug library. */
2 #ifndef _THREAD_DBP_H
3 #define _THREAD_DBP_H 1
5 #include <string.h>
6 #include <unistd.h>
7 #include "proc_service.h"
8 #include "thread_db.h"
9 #include "internals.h"
12 /* Indices for the symbol names. */
13 enum
15 PTHREAD_THREADS_EVENTS = 0,
16 PTHREAD_LAST_EVENT,
17 PTHREAD_HANDLES_NUM,
18 PTHREAD_HANDLES,
19 PTHREAD_KEYS,
20 LINUXTHREADS_PTHREAD_THREADS_MAX,
21 LINUXTHREADS_PTHREAD_KEYS_MAX,
22 LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
23 LINUXTHREADS_CREATE_EVENT,
24 LINUXTHREADS_DEATH_EVENT,
25 LINUXTHREADS_REAP_EVENT,
26 LINUXTHREADS_INITIAL_REPORT_EVENTS,
27 LINUXTHREADS_VERSION,
28 NUM_MESSAGES
32 /* Comment out the following for less verbose output. */
33 #ifndef NDEBUG
34 # define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
35 extern int __td_debug attribute_hidden;
36 #else
37 # define LOG(c)
38 #endif
41 /* Handle for a process. This type is opaque. */
42 struct td_thragent
44 /* Delivered by the debugger and we have to pass it back in the
45 proc callbacks. */
46 struct ps_prochandle *ph;
48 /* Some cached information. */
50 /* Address of the `__pthread_handles' array. */
51 struct pthread_handle_struct *handles;
53 /* Address of the `pthread_kyes' array. */
54 struct pthread_key_struct *keys;
56 /* Maximum number of threads. */
57 int pthread_threads_max;
59 /* Maximum number of thread-local data keys. */
60 int pthread_keys_max;
62 /* Size of 2nd level array for thread-local data keys. */
63 int pthread_key_2ndlevel_size;
65 /* Sizeof struct _pthread_descr_struct. */
66 int sizeof_descr;
68 /* Pointer to the `__pthread_threads_events' variable in the target. */
69 psaddr_t pthread_threads_eventsp;
71 /* Pointer to the `__pthread_last_event' variable in the target. */
72 psaddr_t pthread_last_event;
74 /* Pointer to the `__pthread_handles_num' variable. */
75 psaddr_t pthread_handles_num;
79 /* Type used internally to keep track of thread agent descriptors. */
80 struct agent_list
82 td_thragent_t *ta;
83 struct agent_list *next;
86 /* List of all known descriptors. */
87 extern struct agent_list *__td_agent_list attribute_hidden;
89 /* Function used to test for correct thread agent pointer. */
90 static __inline__ int
91 ta_ok (const td_thragent_t *ta)
93 struct agent_list *runp = __td_agent_list;
95 if (ta == NULL)
96 return 0;
98 while (runp != NULL && runp->ta != ta)
99 runp = runp->next;
101 return runp != NULL;
105 /* Internal wrapper around ps_pglobal_lookup. */
106 extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr) attribute_hidden;
108 #endif /* thread_dbP.h */