Use INTERNAL_SYSCALL.
[glibc.git] / nptl_db / thread_dbP.h
blob4407143af0d327a4e9740aa7b6224aa2c390fb36
1 /* Private header for thread debug library. */
2 #ifndef _THREAD_DBP_H
3 #define _THREAD_DBP_H 1
5 #include <stdbool.h>
6 #include <string.h>
7 #include <unistd.h>
8 #include "proc_service.h"
9 #include "thread_db.h"
10 #include "../nptl/pthreadP.h"
11 #include <list.h>
14 /* Indeces for the symbol names. */
15 enum
17 SYM_PTHREAD_THREADS_EVENTS = 0,
18 SYM_PTHREAD_LAST_EVENT,
19 SYM_PTHREAD_NTHREADS,
20 SYM_PTHREAD_STACK_USED,
21 SYM_PTHREAD_STACK_USER,
22 SYM_PTHREAD_KEYS,
23 SYM_PTHREAD_KEYS_MAX,
24 SYM_PTHREAD_SIZEOF_DESCR,
25 SYM_PTHREAD_CREATE_EVENT,
26 SYM_PTHREAD_DEATH_EVENT,
27 SYM_PTHREAD_VERSION,
28 SYM_NUM_MESSAGES
32 /* Comment out the following for less verbose output. */
33 #ifndef NDEBUG
34 # define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
35 extern int __td_debug;
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 /* Lists of running threads. */
51 psaddr_t stack_used;
52 psaddr_t stack_user;
54 /* Address of the `pthread_keys' array. */
55 struct pthread_key_struct *keys;
57 /* Maximum number of thread-local data keys. */
58 int pthread_keys_max;
60 /* Size of 2nd level array for thread-local data keys. */
61 int pthread_key_2ndlevel_size;
63 /* Sizeof struct _pthread_descr_struct. */
64 int sizeof_descr;
66 /* Pointer to the `__pthread_threads_events' variable in the target. */
67 psaddr_t pthread_threads_eventsp;
69 /* Pointer to the `__pthread_last_event' variable in the target. */
70 psaddr_t pthread_last_event;
72 /* List head the queue agent structures. */
73 list_t list;
77 /* List of all known descriptors. */
78 extern list_t __td_agent_list;
81 /* Function used to test for correct thread agent pointer. */
82 static inline bool
83 ta_ok (const td_thragent_t *ta)
85 list_t *runp;
87 list_for_each (runp, &__td_agent_list)
88 if (list_entry (runp, td_thragent_t, list) == ta)
89 return true;
91 return false;
95 /* Internal wrapper around ps_pglobal_lookup. */
96 extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
98 #endif /* thread_dbP.h */