GDBserver

Classes | Macros | Typedefs | Enumerations | Functions
glibc_thread_db.h File Reference
`#include <pthread.h>`
`#include <stdint.h>`
`#include <sys/types.h>`
`#include <sys/procfs.h>`

Go to the source code of this file.

## Classes
struct | td_thrhandle
struct | td_thr_events
struct | td_notify
struct | td_event_msg
struct | td_eventbuf_t
struct | td_ta_stats
struct | td_thrinfo

## Macros
#define | TD_THR_ANY_USER_FLAGS 0xffffffff
#define | TD_THR_LOWEST_PRIORITY -20
#define | TD_SIGNO_MASK NULL
#define | TD_EVENTSIZE 2
#define | BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */
#define | BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */
#define | BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
#define | __td_eventmask(n) (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
#define | __td_eventword(n) ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
#define | td_event_emptyset(setp)
#define | td_event_fillset(setp)
#define | td_event_addset(setp, n) (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n))
#define | td_event_delset(setp, n) (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n))
#define | td_eventismember(setp, n) (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)]))
#define | td_eventisempty(setp) (!((setp)->event_bits[0]) && !((setp)->event_bits[1]))

## Typedefs
typedef struct td_thragent | td_thragent_t
typedef struct td_thrhandle | td_thrhandle_t
typedef struct td_thr_events | td_thr_events_t
typedef struct td_notify | td_notify_t
typedef struct td_event_msg | td_event_msg_t
typedef struct td_ta_stats | td_ta_stats_t
typedef pthread_t | thread_t
typedef pthread_key_t | thread_key_t
typedef int | td_thr_iter_f(const td_thrhandle_t *, void *)
typedef int | td_key_iter_f(thread_key_t, void(*) (void *), void *)
typedef struct td_thrinfo | td_thrinfo_t

## Enumerations
enum | td_err_e { TD_OK, TD_ERR, TD_NOTHR, TD_NOSV, TD_NOLWP, TD_BADPH, TD_BADTH, TD_BADSH, TD_BADTA, TD_BADKEY, TD_NOMSG, TD_NOFPREGS, TD_NOLIBTHREAD, TD_NOEVENT, TD_NOCAPAB, TD_DBERR, TD_NOAPLIC, TD_NOTSD, TD_MALLOC, TD_PARTIALREG, TD_NOXREGS, TD_TLSDEFER, TD_NOTALLOC = TD_TLSDEFER, TD_VERSION, TD_NOTLS }
enum | td_thr_state_e { TD_THR_ANY_STATE, TD_THR_UNKNOWN, TD_THR_STOPPED, TD_THR_RUN, TD_THR_ACTIVE, TD_THR_ZOMBIE, TD_THR_SLEEP, TD_THR_STOPPED_ASLEEP }
enum | td_thr_type_e { TD_THR_ANY_TYPE, TD_THR_USER, TD_THR_SYSTEM }
enum | td_event_e { TD_ALL_EVENTS, TD_EVENT_NONE = TD_ALL_EVENTS, TD_READY, TD_SLEEP, TD_SWITCHTO, TD_SWITCHFROM, TD_LOCK_TRY, TD_CATCHSIG, TD_IDLE, TD_CREATE, TD_DEATH, TD_PREEMPT, TD_PRI_INHERIT, TD_REAP, TD_CONCURRENCY, TD_TIMEOUT, TD_MIN_EVENT_NUM = TD_READY, TD_MAX_EVENT_NUM = TD_TIMEOUT, TD_EVENTS_ENABLE = 31 }
enum | td_notify_e { NOTIFY_BPT, NOTIFY_AUTOBPT, NOTIFY_SYSCALL }

## Functions
td_err_e | td_init (void)
td_err_e | td_log (void)
const char ** | td_symbol_list (void)
td_err_e | td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta)
td_err_e | td_ta_delete (td_thragent_t *__ta)
td_err_e | td_ta_get_nthreads (const td_thragent_t *__ta, int *__np)
td_err_e | td_ta_get_ph (const td_thragent_t *__ta, struct ps_prochandle **__ph)
td_err_e | td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt, td_thrhandle_t *__th)
td_err_e | td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid, td_thrhandle_t *__th)
td_err_e | td_ta_thr_iter (const td_thragent_t *__ta, td_thr_iter_f *__callback, void *__cbdata_p, td_thr_state_e __state, int __ti_pri, sigset_t *__ti_sigmask_p, unsigned int __ti_user_flags)
td_err_e | td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki, void *__p)
td_err_e | td_ta_event_addr (const td_thragent_t *__ta, td_event_e __event, td_notify_t *__ptr)
td_err_e | td_ta_set_event (const td_thragent_t *__ta, td_thr_events_t *__event)
td_err_e | td_ta_clear_event (const td_thragent_t *__ta, td_thr_events_t *__event)
td_err_e | td_ta_event_getmsg (const td_thragent_t *__ta, td_event_msg_t *__msg)
td_err_e | td_ta_setconcurrency (const td_thragent_t *__ta, int __level)
td_err_e | td_ta_enable_stats (const td_thragent_t *__ta, int __enable)
td_err_e | td_ta_reset_stats (const td_thragent_t *__ta)
td_err_e | td_ta_get_stats (const td_thragent_t *__ta, td_ta_stats_t *__statsp)
td_err_e | td_thr_validate (const td_thrhandle_t *__th)
td_err_e | td_thr_get_info (const td_thrhandle_t *__th, td_thrinfo_t *__infop)
td_err_e | td_thr_getfpregs (const td_thrhandle_t *__th, prfpregset_t *__regset)
td_err_e | td_thr_getgregs (const td_thrhandle_t *__th, prgregset_t __gregs)
td_err_e | td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs)
td_err_e | td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep)
td_err_e | td_thr_setfpregs (const td_thrhandle_t *__th, const prfpregset_t *__fpregs)
td_err_e | td_thr_setgregs (const td_thrhandle_t *__th, prgregset_t __gregs)
td_err_e | td_thr_setxregs (const td_thrhandle_t *__th, const void *__addr)
td_err_e | td_thr_tlsbase (const td_thrhandle_t *__th, unsigned long int __modid, psaddr_t *__base)
td_err_e | td_thr_tls_get_addr (const td_thrhandle_t *__th, psaddr_t __map_address, size_t __offset, psaddr_t *__address)
td_err_e | td_thr_event_enable (const td_thrhandle_t *__th, int __event)
td_err_e | td_thr_set_event (const td_thrhandle_t *__th, td_thr_events_t *__event)
td_err_e | td_thr_clear_event (const td_thrhandle_t *__th, td_thr_events_t *__event)
td_err_e | td_thr_event_getmsg (const td_thrhandle_t *__th, td_event_msg_t *__msg)
td_err_e | td_thr_setprio (const td_thrhandle_t *__th, int __prio)
td_err_e | td_thr_setsigpending (const td_thrhandle_t *__th, unsigned char __n, const sigset_t *__ss)
td_err_e | td_thr_sigsetmask (const td_thrhandle_t *__th, const sigset_t *__ss)
td_err_e | td_thr_tsd (const td_thrhandle_t *__th, const thread_key_t __tk, void **__data)
td_err_e | td_thr_dbsuspend (const td_thrhandle_t *__th)
td_err_e | td_thr_dbresume (const td_thrhandle_t *__th)

## Macro Definition Documentation

## ◆ __td_eventmask

#define __td_eventmask | ( |  | n | ) | (UINT32_C (1) << (((n) - 1) & BT_UIMASK))

Definition at line 121 of file glibc_thread_db.h.

## ◆ __td_eventword

#define __td_eventword | ( |  | n | ) | ((UINT32_C ((n) - 1)) >> BT_UISHIFT)

Definition at line 123 of file glibc_thread_db.h.

## ◆ BT_NBIPUI

#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */

Definition at line 111 of file glibc_thread_db.h.

## ◆ BT_UIMASK

#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */

Definition at line 112 of file glibc_thread_db.h.

## ◆ BT_UISHIFT

#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */

Definition at line 110 of file glibc_thread_db.h.

## ◆ td_event_addset

#define td_event_addset | ( |  | setp,
|  |  | n
| ) |  | (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n))

Definition at line 140 of file glibc_thread_db.h.

## ◆ td_event_delset

#define td_event_delset | ( |  | setp,
|  |  | n
| ) |  | (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n))

Definition at line 142 of file glibc_thread_db.h.

## ◆ td_event_emptyset

#define td_event_emptyset | ( |  | setp | ) |

Value:
do { \
int __i; \
for (__i = TD_EVENTSIZE; __i > 0; --__i) \
(setp)->event_bits[__i - 1] = 0; \
} while (0)
TD_EVENTSIZE
#define TD_EVENTSIZE
Definition: glibc_thread_db.h:109

Definition at line 126 of file glibc_thread_db.h.

## ◆ td_event_fillset

#define td_event_fillset | ( |  | setp | ) |

Value:
do { \
int __i; \
for (__i = TD_EVENTSIZE; __i > 0; --__i) \
(setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \
} while (0)
TD_EVENTSIZE
#define TD_EVENTSIZE
Definition: glibc_thread_db.h:109

Definition at line 133 of file glibc_thread_db.h.

Referenced by disable_thread_event_reporting().

## ◆ td_eventisempty

#define td_eventisempty | ( |  | setp | ) | (!((setp)->event_bits[0]) && !((setp)->event_bits[1]))

Definition at line 147 of file glibc_thread_db.h.

## ◆ td_eventismember

#define td_eventismember | ( |  | setp,
|  |  | n
| ) |  | (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)]))

Definition at line 144 of file glibc_thread_db.h.

## ◆ TD_EVENTSIZE

#define TD_EVENTSIZE 2

Definition at line 109 of file glibc_thread_db.h.

## ◆ TD_SIGNO_MASK

#define TD_SIGNO_MASK NULL

Definition at line 106 of file glibc_thread_db.h.

Referenced by thread_db_find_new_threads().

## ◆ TD_THR_ANY_USER_FLAGS

#define TD_THR_ANY_USER_FLAGS 0xffffffff

Definition at line 104 of file glibc_thread_db.h.

Referenced by thread_db_find_new_threads().

## ◆ TD_THR_LOWEST_PRIORITY

#define TD_THR_LOWEST_PRIORITY -20

Definition at line 105 of file glibc_thread_db.h.

Referenced by thread_db_find_new_threads().

## Typedef Documentation

## ◆ td_event_msg_t

typedef struct td_event_msg td_event_msg_t

## ◆ td_key_iter_f

typedef int td_key_iter_f(thread_key_t, void(*)(void *), void *)

Definition at line 250 of file glibc_thread_db.h.

## ◆ td_notify_t

typedef struct td_notify td_notify_t

## ◆ td_ta_stats_t

typedef struct td_ta_stats td_ta_stats_t

## ◆ td_thr_events_t

typedef struct td_thr_events td_thr_events_t

## ◆ td_thr_iter_f

typedef int td_thr_iter_f(const td_thrhandle_t *, void *)

Definition at line 247 of file glibc_thread_db.h.

## ◆ td_thragent_t

typedef struct td_thragent td_thragent_t

Definition at line 89 of file glibc_thread_db.h.

## ◆ td_thrhandle_t

typedef struct td_thrhandle td_thrhandle_t

## ◆ td_thrinfo_t

typedef struct td_thrinfo td_thrinfo_t

## ◆ thread_key_t

typedef pthread_key_t thread_key_t

Definition at line 243 of file glibc_thread_db.h.

## ◆ thread_t

typedef pthread_t thread_t

Definition at line 242 of file glibc_thread_db.h.

## Enumeration Type Documentation

## ◆ td_err_e

enum td_err_e

Enumerator
TD_OK |
TD_ERR |
TD_NOTHR |
TD_NOSV |
TD_NOLWP |
TD_BADPH |
TD_BADTH |
TD_BADSH |
TD_BADTA |
TD_BADKEY |
TD_NOMSG |
TD_NOFPREGS |
TD_NOLIBTHREAD |
TD_NOEVENT |
TD_NOCAPAB |
TD_DBERR |
TD_NOAPLIC |
TD_NOTSD |
TD_MALLOC |
TD_PARTIALREG |
TD_NOXREGS |
TD_TLSDEFER |
TD_NOTALLOC |
TD_VERSION |
TD_NOTLS |

Definition at line 32 of file glibc_thread_db.h.

## ◆ td_event_e

enum td_event_e

Enumerator
TD_ALL_EVENTS |
TD_EVENT_NONE |
TD_READY |
TD_SLEEP |
TD_SWITCHTO |
TD_SWITCHFROM |
TD_LOCK_TRY |
TD_CATCHSIG |
TD_IDLE |
TD_CREATE |
TD_DEATH |
TD_PREEMPT |
TD_PRI_INHERIT |
TD_REAP |
TD_CONCURRENCY |
TD_TIMEOUT |
TD_MIN_EVENT_NUM |
TD_MAX_EVENT_NUM |
TD_EVENTS_ENABLE |

Definition at line 154 of file glibc_thread_db.h.

## ◆ td_notify_e

enum td_notify_e

Enumerator
NOTIFY_BPT |
NOTIFY_AUTOBPT |
NOTIFY_SYSCALL |

Definition at line 178 of file glibc_thread_db.h.

## ◆ td_thr_state_e

enum td_thr_state_e

Enumerator
TD_THR_ANY_STATE |
TD_THR_UNKNOWN |
TD_THR_STOPPED |
TD_THR_RUN |
TD_THR_ACTIVE |
TD_THR_ZOMBIE |
TD_THR_SLEEP |
TD_THR_STOPPED_ASLEEP |

Definition at line 64 of file glibc_thread_db.h.

## ◆ td_thr_type_e

enum td_thr_type_e

Enumerator
TD_THR_ANY_TYPE |
TD_THR_USER |
TD_THR_SYSTEM |

Definition at line 78 of file glibc_thread_db.h.

## Function Documentation

## ◆ td_init()

td_err_e td_init | ( | void |  | ) |

Referenced by try_thread_db_load().

## ◆ td_log()

td_err_e td_log | ( | void |  | ) |

## ◆ td_symbol_list()

const char** td_symbol_list | ( | void |  | ) |

Referenced by try_thread_db_load_1().

## ◆ td_ta_clear_event()

td_err_e td_ta_clear_event | ( | const td_thragent_t * | __ta,
|  | td_thr_events_t * | __event
| ) |  |

Referenced by disable_thread_event_reporting().

## ◆ td_ta_delete()

td_err_e td_ta_delete | ( | td_thragent_t * | __ta | ) |

Referenced by thread_db_mourn().

## ◆ td_ta_enable_stats()

td_err_e td_ta_enable_stats | ( | const td_thragent_t * | __ta,
|  | int | __enable
| ) |  |

## ◆ td_ta_event_addr()

td_err_e td_ta_event_addr | ( | const td_thragent_t * | __ta,
|  | td_event_e | __event,
|  | td_notify_t * | __ptr
| ) |  |

## ◆ td_ta_event_getmsg()

td_err_e td_ta_event_getmsg | ( | const td_thragent_t * | __ta,
|  | td_event_msg_t * | __msg
| ) |  |

## ◆ td_ta_get_nthreads()

td_err_e td_ta_get_nthreads | ( | const td_thragent_t * | __ta,
|  | int * | __np
| ) |  |

## ◆ td_ta_get_ph()

td_err_e td_ta_get_ph | ( | const td_thragent_t * | __ta,
|  | struct ps_prochandle ** | __ph
| ) |  |

## ◆ td_ta_get_stats()

td_err_e td_ta_get_stats | ( | const td_thragent_t * | __ta,
|  | td_ta_stats_t * | __statsp
| ) |  |

## ◆ td_ta_map_id2thr()

td_err_e td_ta_map_id2thr | ( | const td_thragent_t * | __ta,
|  | pthread_t | __pt,
|  | td_thrhandle_t * | __th
| ) |  |

## ◆ td_ta_map_lwp2thr()

td_err_e td_ta_map_lwp2thr | ( | const td_thragent_t * | __ta,
|  | lwpid_t | __lwpid,
|  | td_thrhandle_t * | __th
| ) |  |

Referenced by try_thread_db_load_1().

## ◆ td_ta_new()

td_err_e td_ta_new | ( | struct ps_prochandle * | __ps,
|  | td_thragent_t ** | __ta
| ) |  |

Referenced by try_thread_db_load_1().

## ◆ td_ta_reset_stats()

td_err_e td_ta_reset_stats | ( | const td_thragent_t * | __ta | ) |

## ◆ td_ta_set_event()

td_err_e td_ta_set_event | ( | const td_thragent_t * | __ta,
|  | td_thr_events_t * | __event
| ) |  |

## ◆ td_ta_setconcurrency()

td_err_e td_ta_setconcurrency | ( | const td_thragent_t * | __ta,
|  | int | __level
| ) |  |

## ◆ td_ta_thr_iter()

td_err_e td_ta_thr_iter | ( | const td_thragent_t * | __ta,
|  | td_thr_iter_f * | __callback,
|  | void * | __cbdata_p,
|  | td_thr_state_e | __state,
|  | int | __ti_pri,
|  | sigset_t * | __ti_sigmask_p,
|  | unsigned int | __ti_user_flags
| ) |  |

Referenced by try_thread_db_load_1().

## ◆ td_ta_tsd_iter()

td_err_e td_ta_tsd_iter | ( | const td_thragent_t * | __ta,
|  | td_key_iter_f * | __ki,
|  | void * | __p
| ) |  |

## ◆ td_thr_clear_event()

td_err_e td_thr_clear_event | ( | const td_thrhandle_t * | __th,
|  | td_thr_events_t * | __event
| ) |  |

## ◆ td_thr_dbresume()

td_err_e td_thr_dbresume | ( | const td_thrhandle_t * | __th | ) |

## ◆ td_thr_dbsuspend()

td_err_e td_thr_dbsuspend | ( | const td_thrhandle_t * | __th | ) |

## ◆ td_thr_event_enable()

td_err_e td_thr_event_enable | ( | const td_thrhandle_t * | __th,
|  | int | __event
| ) |  |

## ◆ td_thr_event_getmsg()

td_err_e td_thr_event_getmsg | ( | const td_thrhandle_t * | __th,
|  | td_event_msg_t * | __msg
| ) |  |

## ◆ td_thr_get_info()

td_err_e td_thr_get_info | ( | const td_thrhandle_t * | __th,
|  | td_thrinfo_t * | __infop
| ) |  |

Referenced by try_thread_db_load_1().

## ◆ td_thr_getfpregs()

td_err_e td_thr_getfpregs | ( | const td_thrhandle_t * | __th,
|  | prfpregset_t * | __regset
| ) |  |

## ◆ td_thr_getgregs()

td_err_e td_thr_getgregs | ( | const td_thrhandle_t * | __th,
|  | prgregset_t | __gregs
| ) |  |

## ◆ td_thr_getxregs()

td_err_e td_thr_getxregs | ( | const td_thrhandle_t * | __th,
|  | void * | __xregs
| ) |  |

## ◆ td_thr_getxregsize()

td_err_e td_thr_getxregsize | ( | const td_thrhandle_t * | __th,
|  | int * | __sizep
| ) |  |

## ◆ td_thr_set_event()

td_err_e td_thr_set_event | ( | const td_thrhandle_t * | __th,
|  | td_thr_events_t * | __event
| ) |  |

## ◆ td_thr_setfpregs()

td_err_e td_thr_setfpregs | ( | const td_thrhandle_t * | __th,
|  | const prfpregset_t * | __fpregs
| ) |  |

## ◆ td_thr_setgregs()

td_err_e td_thr_setgregs | ( | const td_thrhandle_t * | __th,
|  | prgregset_t | __gregs
| ) |  |

## ◆ td_thr_setprio()

td_err_e td_thr_setprio | ( | const td_thrhandle_t * | __th,
|  | int | __prio
| ) |  |

## ◆ td_thr_setsigpending()

td_err_e td_thr_setsigpending | ( | const td_thrhandle_t * | __th,
|  | unsigned char | __n,
|  | const sigset_t * | __ss
| ) |  |

## ◆ td_thr_setxregs()

td_err_e td_thr_setxregs | ( | const td_thrhandle_t * | __th,
|  | const void * | __addr
| ) |  |

## ◆ td_thr_sigsetmask()

td_err_e td_thr_sigsetmask | ( | const td_thrhandle_t * | __th,
|  | const sigset_t * | __ss
| ) |  |

## ◆ td_thr_tls_get_addr()

td_err_e td_thr_tls_get_addr | ( | const td_thrhandle_t * | __th,
|  | psaddr_t | __map_address,
|  | size_t | __offset,
|  | psaddr_t * | __address
| ) |  |

Referenced by try_thread_db_load_1().

## ◆ td_thr_tlsbase()

td_err_e td_thr_tlsbase | ( | const td_thrhandle_t * | __th,
|  | unsigned long int | __modid,
|  | psaddr_t * | __base
| ) |  |

Referenced by try_thread_db_load_1().

## ◆ td_thr_tsd()

td_err_e td_thr_tsd | ( | const td_thrhandle_t * | __th,
|  | const thread_key_t | __tk,
|  | void ** | __data
| ) |  |

## ◆ td_thr_validate()

td_err_e td_thr_validate | ( | const td_thrhandle_t * | __th | ) |