]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl_db/thread_dbP.h
Initial revision
[thirdparty/glibc.git] / nptl_db / thread_dbP.h
CommitLineData
76a50749
UD
1/* Private header for thread debug library. */
2#ifndef _THREAD_DBP_H
3#define _THREAD_DBP_H 1
4
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>
12
13
14/* Indeces for the symbol names. */
15enum
16 {
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
29 };
30
31
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"))
35extern int __td_debug;
36#else
37# define LOG(c)
38#endif
39
40
41/* Handle for a process. This type is opaque. */
42struct 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 /* Lists of running threads. */
51 psaddr_t stack_used;
52 psaddr_t stack_user;
53
54 /* Address of the `pthread_keys' array. */
55 struct pthread_key_struct *keys;
56
57 /* Maximum number of thread-local data keys. */
58 int pthread_keys_max;
59
60 /* Size of 2nd level array for thread-local data keys. */
61 int pthread_key_2ndlevel_size;
62
63 /* Sizeof struct _pthread_descr_struct. */
64 int sizeof_descr;
65
66 /* Pointer to the `__pthread_threads_events' variable in the target. */
67 psaddr_t pthread_threads_eventsp;
68
69 /* Pointer to the `__pthread_last_event' variable in the target. */
70 psaddr_t pthread_last_event;
71
72 /* List head the queue agent structures. */
73 list_t list;
74};
75
76
77/* List of all known descriptors. */
78extern list_t __td_agent_list;
79
80
81/* Function used to test for correct thread agent pointer. */
82static inline bool
83ta_ok (const td_thragent_t *ta)
84{
85 list_t *runp;
86
87 list_for_each (runp, &__td_agent_list)
88 if (list_entry (runp, td_thragent_t, list) == ta)
89 return true;
90
91 return false;
92}
93
94
95/* Internal wrapper around ps_pglobal_lookup. */
96extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
97
98#endif /* thread_dbP.h */