Back to index

glibc  2.9
db_info.c
Go to the documentation of this file.
00001 /* This file is included by pthread_create.c to define in libpthread
00002    all the magic symbols required by libthread_db.
00003 
00004    Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
00005    This file is part of the GNU C Library.
00006 
00007    The GNU C Library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Lesser General Public
00009    License as published by the Free Software Foundation; either
00010    version 2.1 of the License, or (at your option) any later version.
00011 
00012    The GNU C Library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Lesser General Public License for more details.
00016 
00017    You should have received a copy of the GNU Lesser General Public
00018    License along with the GNU C Library; if not, write to the Free
00019    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00020    02111-1307 USA.  */
00021 
00022 #include "thread_dbP.h"
00023 #include <tls.h>
00024 
00025 typedef struct pthread pthread;
00026 typedef struct pthread_key_struct pthread_key_struct;
00027 typedef struct pthread_key_data pthread_key_data;
00028 typedef struct
00029 {
00030   struct pthread_key_data data[PTHREAD_KEY_2NDLEVEL_SIZE];
00031 }
00032 pthread_key_data_level2;
00033 
00034 typedef struct
00035 {
00036   union dtv dtv[UINT32_MAX / 2 / sizeof (union dtv)]; /* No constant bound.  */
00037 } dtv;
00038 
00039 typedef struct link_map link_map;
00040 
00041 /* Actually static in nptl/init.c, but we only need it for typeof.  */
00042 extern bool __nptl_initial_report_events;
00043 
00044 #define schedparam_sched_priority schedparam.sched_priority
00045 
00046 #define eventbuf_eventmask eventbuf.eventmask
00047 #define eventbuf_eventmask_event_bits eventbuf.eventmask.event_bits
00048 
00049 #define DESC(name, offset, obj) \
00050   DB_DEFINE_DESC (name, 8 * sizeof (obj), 1, offset);
00051 #define ARRAY_DESC(name, offset, obj) \
00052   DB_DEFINE_DESC (name, \
00053                 8 * sizeof (obj)[0], sizeof (obj) / sizeof (obj)[0], \
00054                 offset);
00055 
00056 #if TLS_TCB_AT_TP
00057 # define dtvp header.dtv
00058 #elif TLS_DTV_AT_TP
00059 /* Special case hack.  If TLS_TCB_SIZE == 0 (on PowerPC), there is no TCB
00060    containing the DTV at the TP, but actually the TCB lies behind the TP,
00061    i.e. at the very end of the area covered by TLS_PRE_TCB_SIZE.  */
00062 DESC (_thread_db_pthread_dtvp,
00063       TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv)
00064       - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv *)
00065 #endif
00066 
00067 
00068 #define DB_STRUCT(type) \
00069   const uint32_t _thread_db_sizeof_##type = sizeof (type);
00070 #define DB_STRUCT_FIELD(type, field) \
00071   DESC (_thread_db_##type##_##field, \
00072        offsetof (type, field), ((type *) 0)->field)
00073 #define DB_STRUCT_ARRAY_FIELD(type, field) \
00074   ARRAY_DESC (_thread_db_##type##_##field, \
00075              offsetof (type, field), ((type *) 0)->field)
00076 #define DB_VARIABLE(name) DESC (_thread_db_##name, 0, name)
00077 #define DB_ARRAY_VARIABLE(name) ARRAY_DESC (_thread_db_##name, 0, name)
00078 #define DB_SYMBOL(name)     /* Nothing.  */
00079 #define DB_FUNCTION(name) /* Nothing.  */
00080 #include "structs.def"
00081 #undef DB_STRUCT
00082 #undef DB_STRUCT_FIELD
00083 #undef DB_SYMBOL
00084 #undef DB_FUNCTION
00085 #undef DB_VARIABLE
00086 #undef DESC
00087 
00088 
00089 
00090 #ifdef DB_THREAD_SELF
00091 # ifdef DB_THREAD_SELF_INCLUDE
00092 #  include DB_THREAD_SELF_INCLUDE
00093 # endif
00094 
00095 /* This macro is defined in the machine's tls.h using the three below.  */
00096 # define CONST_THREAD_AREA(bits, value) \
00097   const uint32_t _thread_db_const_thread_area = (value);
00098 # define REGISTER_THREAD_AREA(bits, regofs, scale) \
00099   DB_DEFINE_DESC (_thread_db_register##bits##_thread_area, \
00100                 bits, (scale), (regofs));
00101 # define REGISTER(bits, size, regofs, bias) \
00102   DB_DEFINE_DESC (_thread_db_register##bits, size, (uint32_t)(bias), (regofs));
00103 
00104 DB_THREAD_SELF
00105 #endif