thread_dbP.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* Private header for thread debug library. */
  2. #ifndef _THREAD_DBP_H
  3. #define _THREAD_DBP_H 1
  4. #include <string.h>
  5. #include "proc_service.h"
  6. #include "thread_db.h"
  7. #include "../linuxthreads/internals.h"
  8. /* Comment out the following for less verbose output. */
  9. #ifndef NDEBUG
  10. # define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
  11. extern int __td_debug;
  12. #else
  13. # define LOG(c)
  14. #endif
  15. /* Handle for a process. This type is opaque. */
  16. struct td_thragent
  17. {
  18. /* Delivered by the debugger and we have to pass it back in the
  19. proc callbacks. */
  20. struct ps_prochandle *ph;
  21. /* Some cached information. */
  22. /* Address of the `__pthread_handles' array. */
  23. struct pthread_handle_struct *handles;
  24. /* Address of the `pthread_kyes' array. */
  25. struct pthread_key_struct *keys;
  26. /* Maximum number of threads. */
  27. int pthread_threads_max;
  28. /* Maximum number of thread-local data keys. */
  29. int pthread_keys_max;
  30. /* Size of 2nd level array for thread-local data keys. */
  31. int pthread_key_2ndlevel_size;
  32. /* Sizeof struct _pthread_descr_struct. */
  33. int sizeof_descr;
  34. /* Pointer to the `__pthread_threads_events' variable in the target. */
  35. psaddr_t pthread_threads_eventsp;
  36. /* Pointer to the `__pthread_last_event' variable in the target. */
  37. psaddr_t pthread_last_event;
  38. /* Pointer to the `__pthread_handles_num' variable. */
  39. psaddr_t pthread_handles_num;
  40. };
  41. /* Type used internally to keep track of thread agent descriptors. */
  42. struct agent_list
  43. {
  44. td_thragent_t *ta;
  45. struct agent_list *next;
  46. };
  47. /* List of all known descriptors. */
  48. extern struct agent_list *__td_agent_list;
  49. /* Function used to test for correct thread agent pointer. */
  50. static inline int
  51. ta_ok (const td_thragent_t *ta)
  52. {
  53. struct agent_list *runp = __td_agent_list;
  54. if (ta == NULL)
  55. return 0;
  56. while (runp != NULL && runp->ta != ta)
  57. runp = runp->next;
  58. return runp != NULL;
  59. }
  60. #endif /* thread_dbP.h */