1 /* This file is included by pthread_create.c to define in libpthread 2 all the magic symbols required by libthread_db. 3 4 Copyright (C) 2003, 2004 Free Software Foundation, Inc. 5 This file is part of the GNU C Library. 6 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. 11 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. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with the GNU C Library; if not, see 19 <http://www.gnu.org/licenses/>. */ 20 21 #include "thread_dbP.h" 22 #include <tls.h> 23 24 typedef struct pthread pthread; 25 typedef struct pthread_key_struct pthread_key_struct; 26 typedef struct pthread_key_data pthread_key_data; 27 typedef struct 28 { 29 struct pthread_key_data data[PTHREAD_KEY_2NDLEVEL_SIZE]; 30 } 31 pthread_key_data_level2; 32 33 typedef struct 34 { 35 union dtv dtv[UINT32_MAX / 2 / sizeof (union dtv)]; /* No constant bound. */ 36 } dtv; 37 38 typedef struct link_map link_map; 39 40 41 #define schedparam_sched_priority schedparam.sched_priority 42 43 #define eventbuf_eventmask eventbuf.eventmask 44 #define eventbuf_eventmask_event_bits eventbuf.eventmask.event_bits 45 46 #define DESC(name, offset, obj) \ 47 DB_DEFINE_DESC (name, 8 * sizeof (obj), 1, offset); 48 #define ARRAY_DESC(name, offset, obj) \ 49 DB_DEFINE_DESC (name, \ 50 8 * sizeof (obj)[0], sizeof (obj) / sizeof (obj)[0], \ 51 offset); 52 53 #if defined(TLS_TCB_AT_TP) 54 # define dtvp header.dtv 55 #elif defined(TLS_DTV_AT_TP) 56 /* Special case hack. If TLS_TCB_SIZE == 0 (on PowerPC), there is no TCB 57 containing the DTV at the TP, but actually the TCB lies behind the TP, 58 i.e. at the very end of the area covered by TLS_PRE_TCB_SIZE. */ 59 DESC (_thread_db_pthread_dtvp, 60 TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv) 61 - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv) 62 #endif 63 64 65 #define DB_STRUCT(type) \ 66 const uint32_t _thread_db_sizeof_##type = sizeof (type); 67 #define DB_STRUCT_FIELD(type, field) \ 68 DESC (_thread_db_##type##_##field, \ 69 offsetof (type, field), ((type *) 0)->field) 70 #define DB_STRUCT_ARRAY_FIELD(type, field) \ 71 ARRAY_DESC (_thread_db_##type##_##field, \ 72 offsetof (type, field), ((type *) 0)->field) 73 #define DB_VARIABLE(name) DESC (_thread_db_##name, 0, name) 74 #define DB_ARRAY_VARIABLE(name) ARRAY_DESC (_thread_db_##name, 0, name) 75 #define DB_SYMBOL(name) /* Nothing. */ 76 #define DB_FUNCTION(name) /* Nothing. */ 77 #include "structs.def" 78 #undef DB_STRUCT 79 #undef DB_STRUCT_FIELD 80 #undef DB_SYMBOL 81 #undef DB_FUNCTION 82 #undef DB_VARIABLE 83 #undef DESC 84 85 86 87 #ifdef DB_THREAD_SELF 88 # ifdef DB_THREAD_SELF_INCLUDE 89 # include DB_THREAD_SELF_INCLUDE 90 # endif 91 92 /* This macro is defined in the machine's tls.h using the three below. */ 93 # define CONST_THREAD_AREA(bits, value) \ 94 const uint32_t _thread_db_const_thread_area = (value); 95 # define REGISTER_THREAD_AREA(bits, regofs, scale) \ 96 DB_DEFINE_DESC (_thread_db_register##bits##_thread_area, \ 97 bits, (scale), (regofs)); 98 # define REGISTER(bits, size, regofs, bias) \ 99 DB_DEFINE_DESC (_thread_db_register##bits, size, (uint32_t)(bias), (regofs)); 100 101 DB_THREAD_SELF 102 #endif 103