(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / nptl_db / db_info.c
blob5000b99ba549145d60c0418c05e8ba03512e5541
1 /* This file is included by pthread_create.c to define in libpthread
2 all the magic symbols required by libthread_db.
4 Copyright (C) 2003, 2004 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA. */
22 #include "thread_dbP.h"
23 #include <tls.h>
25 typedef struct pthread pthread;
26 typedef struct pthread_key_struct pthread_key_struct;
27 typedef struct pthread_key_data pthread_key_data;
28 typedef struct
30 struct pthread_key_data data[PTHREAD_KEY_2NDLEVEL_SIZE];
32 pthread_key_data_level2;
34 typedef struct
36 union dtv dtv[UINT32_MAX / 2 / sizeof (union dtv)]; /* No constant bound. */
37 } dtv;
39 typedef struct link_map link_map;
42 #define schedparam_sched_priority schedparam.sched_priority
44 #define eventbuf_eventmask eventbuf.eventmask
45 #define eventbuf_eventmask_event_bits eventbuf.eventmask.event_bits
47 #define DESC(name, offset, obj) \
48 DB_DEFINE_DESC (name, 8 * sizeof (obj), 1, offset);
49 #define ARRAY_DESC(name, offset, obj) \
50 DB_DEFINE_DESC (name, \
51 8 * sizeof (obj)[0], sizeof (obj) / sizeof (obj)[0], \
52 offset);
54 #if TLS_TCB_AT_TP
55 # define dtvp header.dtv
56 #elif TLS_DTV_AT_TP
57 /* Special case hack. If TLS_TCB_SIZE == 0 (on PowerPC), there is no TCB
58 containing the DTV at the TP, but actually the TCB lies behind the TP,
59 i.e. at the very end of the area covered by TLS_PRE_TCB_SIZE. */
60 DESC (_thread_db_pthread_dtvp,
61 TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv)
62 - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv)
63 #endif
66 #define DB_STRUCT(type) \
67 const uint32_t _thread_db_sizeof_##type = sizeof (type);
68 #define DB_STRUCT_FIELD(type, field) \
69 DESC (_thread_db_##type##_##field, \
70 offsetof (type, field), ((type *) 0)->field)
71 #define DB_STRUCT_ARRAY_FIELD(type, field) \
72 ARRAY_DESC (_thread_db_##type##_##field, \
73 offsetof (type, field), ((type *) 0)->field)
74 #define DB_VARIABLE(name) DESC (_thread_db_##name, 0, name)
75 #define DB_ARRAY_VARIABLE(name) ARRAY_DESC (_thread_db_##name, 0, name)
76 #define DB_SYMBOL(name) /* Nothing. */
77 #define DB_FUNCTION(name) /* Nothing. */
78 #include "structs.def"
79 #undef DB_STRUCT
80 #undef DB_STRUCT_FIELD
81 #undef DB_SYMBOL
82 #undef DB_FUNCTION
83 #undef DB_VARIABLE
84 #undef DESC
88 #ifdef DB_THREAD_SELF
89 # ifdef DB_THREAD_SELF_INCLUDE
90 # include DB_THREAD_SELF_INCLUDE
91 # endif
93 /* This macro is defined in the machine's tls.h using the three below. */
94 # define CONST_THREAD_AREA(bits, value) \
95 const uint32_t _thread_db_const_thread_area = (value);
96 # define REGISTER_THREAD_AREA(bits, regofs, scale) \
97 DB_DEFINE_DESC (_thread_db_register##bits##_thread_area, \
98 bits, (scale), (regofs));
99 # define REGISTER(bits, size, regofs, bias) \
100 DB_DEFINE_DESC (_thread_db_register##bits, size, (uint32_t)(bias), (regofs));
102 DB_THREAD_SELF
103 #endif