thread_dbP.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* Private header for thread debug library. */
  2. #ifndef _THREAD_DBP_H
  3. #define _THREAD_DBP_H 1
  4. #define __FORCE_GLIBC
  5. #include <features.h>
  6. #include <string.h>
  7. #include <unistd.h>
  8. #include "proc_service.h"
  9. #include "thread_db.h"
  10. #include "../linuxthreads/internals.h"
  11. /* Indeces for the symbol names. */
  12. enum
  13. {
  14. PTHREAD_THREADS_EVENTS = 0,
  15. PTHREAD_LAST_EVENT,
  16. PTHREAD_HANDLES_NUM,
  17. PTHREAD_HANDLES,
  18. PTHREAD_KEYS,
  19. LINUXTHREADS_PTHREAD_THREADS_MAX,
  20. LINUXTHREADS_PTHREAD_KEYS_MAX,
  21. LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
  22. LINUXTHREADS_CREATE_EVENT,
  23. LINUXTHREADS_DEATH_EVENT,
  24. LINUXTHREADS_REAP_EVENT,
  25. LINUXTHREADS_INITIAL_REPORT_EVENTS,
  26. LINUXTHREADS_VERSION,
  27. NUM_MESSAGES
  28. };
  29. /* Comment out the following for less verbose output. */
  30. #ifndef NDEBUG
  31. # define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
  32. extern int __td_debug;
  33. #else
  34. # define LOG(c)
  35. #endif
  36. /* Handle for a process. This type is opaque. */
  37. struct td_thragent
  38. {
  39. /* Delivered by the debugger and we have to pass it back in the
  40. proc callbacks. */
  41. struct ps_prochandle *ph;
  42. /* Some cached information. */
  43. /* Address of the `__pthread_handles' array. */
  44. struct pthread_handle_struct *handles;
  45. /* Address of the `pthread_kyes' array. */
  46. struct pthread_key_struct *keys;
  47. /* Maximum number of threads. */
  48. int pthread_threads_max;
  49. /* Maximum number of thread-local data keys. */
  50. int pthread_keys_max;
  51. /* Size of 2nd level array for thread-local data keys. */
  52. int pthread_key_2ndlevel_size;
  53. /* Sizeof struct _pthread_descr_struct. */
  54. int sizeof_descr;
  55. /* Pointer to the `__pthread_threads_events' variable in the target. */
  56. psaddr_t pthread_threads_eventsp;
  57. /* Pointer to the `__pthread_last_event' variable in the target. */
  58. psaddr_t pthread_last_event;
  59. /* Pointer to the `__pthread_handles_num' variable. */
  60. psaddr_t pthread_handles_num;
  61. };
  62. /* Type used internally to keep track of thread agent descriptors. */
  63. struct agent_list
  64. {
  65. td_thragent_t *ta;
  66. struct agent_list *next;
  67. };
  68. /* List of all known descriptors. */
  69. extern struct agent_list *__td_agent_list;
  70. /* Function used to test for correct thread agent pointer. */
  71. static inline int
  72. ta_ok (const td_thragent_t *ta)
  73. {
  74. struct agent_list *runp = __td_agent_list;
  75. if (ta == NULL)
  76. return 0;
  77. while (runp != NULL && runp->ta != ta)
  78. runp = runp->next;
  79. return runp != NULL;
  80. }
  81. /* Internal wrapper around ps_pglobal_lookup. */
  82. extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
  83. #endif /* thread_dbP.h */