]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libpthread/linuxthreads.old_db/thread_dbP.h
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libpthread / linuxthreads.old_db / thread_dbP.h
1 /* Private header for thread debug library.  */
2 #ifndef _THREAD_DBP_H
3 #define _THREAD_DBP_H   1
4
5 #include <string.h>
6 #include <unistd.h>
7 #include "proc_service.h"
8 #include "thread_db.h"
9 #include "internals.h"
10
11
12 /* Indices for the symbol names.  */
13 enum
14   {
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
29   };
30
31
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
39
40
41 /* Handle for a process.  This type is opaque.  */
42 struct td_thragent
43 {
44   /* Delivered by the debugger and we have to pass it back in the
45      proc callbacks.  */
46   struct ps_prochandle *ph;
47
48   /* Some cached information.  */
49
50   /* Address of the `__pthread_handles' array.  */
51   struct pthread_handle_struct *handles;
52
53   /* Address of the `pthread_kyes' array.  */
54   struct pthread_key_struct *keys;
55
56   /* Maximum number of threads.  */
57   int pthread_threads_max;
58
59   /* Maximum number of thread-local data keys.  */
60   int pthread_keys_max;
61
62   /* Size of 2nd level array for thread-local data keys.  */
63   int pthread_key_2ndlevel_size;
64
65   /* Sizeof struct _pthread_descr_struct.  */
66   int sizeof_descr;
67
68   /* Pointer to the `__pthread_threads_events' variable in the target.  */
69   psaddr_t pthread_threads_eventsp;
70
71   /* Pointer to the `__pthread_last_event' variable in the target.  */
72   psaddr_t pthread_last_event;
73
74   /* Pointer to the `__pthread_handles_num' variable.  */
75   psaddr_t pthread_handles_num;
76 };
77
78
79 /* Type used internally to keep track of thread agent descriptors.  */
80 struct agent_list
81 {
82   td_thragent_t *ta;
83   struct agent_list *next;
84 };
85
86 /* List of all known descriptors.  */
87 extern struct agent_list *__td_agent_list attribute_hidden;
88
89 /* Function used to test for correct thread agent pointer.  */
90 static __inline__ int
91 ta_ok (const td_thragent_t *ta)
92 {
93   struct agent_list *runp = __td_agent_list;
94
95   if (ta == NULL)
96     return 0;
97
98   while (runp != NULL && runp->ta != ta)
99     runp = runp->next;
100
101   return runp != NULL;
102 }
103
104
105 /* Internal wrapper around ps_pglobal_lookup.  */
106 extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr) attribute_hidden;
107
108 #endif /* thread_dbP.h */