Back to index

glibc  2.9
thread_dbP.h
Go to the documentation of this file.
00001 /* Private header for thread debug library.  */
00002 #ifndef _THREAD_DBP_H
00003 #define _THREAD_DBP_H       1
00004 
00005 #include <string.h>
00006 #include <unistd.h>
00007 #include "proc_service.h"
00008 #include "thread_db.h"
00009 #include "../linuxthreads/descr.h"
00010 
00011 
00012 /* Indices for the symbol names.  */
00013 enum
00014   {
00015     PTHREAD_THREADS_EVENTS = 0,
00016     PTHREAD_LAST_EVENT,
00017     PTHREAD_HANDLES_NUM,
00018     PTHREAD_HANDLES,
00019     PTHREAD_KEYS,
00020     LINUXTHREADS_PTHREAD_THREADS_MAX,
00021     LINUXTHREADS_PTHREAD_KEYS_MAX,
00022     LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
00023     LINUXTHREADS_CREATE_EVENT,
00024     LINUXTHREADS_DEATH_EVENT,
00025     LINUXTHREADS_REAP_EVENT,
00026     LINUXTHREADS_INITIAL_REPORT_EVENTS,
00027     LINUXTHREADS_VERSION,
00028     NUM_MESSAGES
00029   };
00030 
00031 
00032 /* Comment out the following for less verbose output.  */
00033 #ifndef NDEBUG
00034 # define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
00035 extern int __td_debug;
00036 #else
00037 # define LOG(c)
00038 #endif
00039 
00040 
00041 /* Handle for a process.  This type is opaque.  */
00042 struct td_thragent
00043 {
00044   /* Delivered by the debugger and we have to pass it back in the
00045      proc callbacks.  */
00046   struct ps_prochandle *ph;
00047 
00048   /* Some cached information.  */
00049 
00050   /* Address of the `__pthread_handles' array.  */
00051   struct pthread_handle_struct *handles;
00052 
00053   /* Address of the `pthread_kyes' array.  */
00054   struct pthread_key_struct *keys;
00055 
00056   /* Maximum number of threads.  */
00057   int pthread_threads_max;
00058 
00059   /* Maximum number of thread-local data keys.  */
00060   int pthread_keys_max;
00061 
00062   /* Size of 2nd level array for thread-local data keys.  */
00063   int pthread_key_2ndlevel_size;
00064 
00065   /* Sizeof struct _pthread_descr_struct.  */
00066   int sizeof_descr;
00067 
00068   /* Pointer to the `__pthread_threads_events' variable in the target.  */
00069   psaddr_t pthread_threads_eventsp;
00070 
00071   /* Pointer to the `__pthread_last_event' variable in the target.  */
00072   psaddr_t pthread_last_event;
00073 
00074   /* Pointer to the `__pthread_handles_num' variable.  */
00075   psaddr_t pthread_handles_num;
00076 };
00077 
00078 
00079 /* Type used internally to keep track of thread agent descriptors.  */
00080 struct agent_list
00081 {
00082   td_thragent_t *ta;
00083   struct agent_list *next;
00084 };
00085 
00086 /* List of all known descriptors.  */
00087 extern struct agent_list *__td_agent_list;
00088 
00089 /* Function used to test for correct thread agent pointer.  */
00090 static inline int
00091 ta_ok (const td_thragent_t *ta)
00092 {
00093   struct agent_list *runp = __td_agent_list;
00094 
00095   if (ta == NULL)
00096     return 0;
00097 
00098   while (runp != NULL && runp->ta != ta)
00099     runp = runp->next;
00100 
00101   return runp != NULL;
00102 }
00103 
00104 
00105 /* Internal wrapper around ps_pglobal_lookup.  */
00106 extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
00107 
00108 #endif /* thread_dbP.h */