1b725ae77Skettenis #ifdef HAVE_THREAD_DB_H 2b725ae77Skettenis #include <thread_db.h> 3b725ae77Skettenis #else 4b725ae77Skettenis 5b725ae77Skettenis #ifdef HAVE_STDINT_H 6b725ae77Skettenis #include <stdint.h> 7b725ae77Skettenis typedef uint32_t gdb_uint32_t; 8b725ae77Skettenis #define GDB_UINT32_C(c) UINT32_C(c) 9b725ae77Skettenis #else 10b725ae77Skettenis typedef unsigned int gdb_uint32_t; 11b725ae77Skettenis #define GDB_UINT32_C(c) c ## U 12b725ae77Skettenis #endif 13b725ae77Skettenis 14b725ae77Skettenis /* Copyright 1999, 2000 Free Software Foundation, Inc. 15b725ae77Skettenis This file is part of the GNU C Library. 16b725ae77Skettenis 17b725ae77Skettenis The GNU C Library is free software; you can redistribute it and/or 18b725ae77Skettenis modify it under the terms of the GNU Library General Public License as 19b725ae77Skettenis published by the Free Software Foundation; either version 2 of the 20b725ae77Skettenis License, or (at your option) any later version. 21b725ae77Skettenis 22b725ae77Skettenis The GNU C Library is distributed in the hope that it will be useful, 23b725ae77Skettenis but WITHOUT ANY WARRANTY; without even the implied warranty of 24b725ae77Skettenis MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25b725ae77Skettenis Library General Public License for more details. 26b725ae77Skettenis 27b725ae77Skettenis You should have received a copy of the GNU Library General Public 28b725ae77Skettenis License along with the GNU C Library; see the file COPYING.LIB. If not, 29b725ae77Skettenis write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 30b725ae77Skettenis Boston, MA 02111-1307, USA. */ 31b725ae77Skettenis 32b725ae77Skettenis #ifndef _THREAD_DB_H 33b725ae77Skettenis #define _THREAD_DB_H 1 34b725ae77Skettenis 35b725ae77Skettenis /* This is the debugger interface for the LinuxThreads library. It is 36b725ae77Skettenis modelled closely after the interface with same names in Solaris with 37b725ae77Skettenis the goal to share the same code in the debugger. */ 38b725ae77Skettenis #include <pthread.h> 39b725ae77Skettenis #include <sys/types.h> 40b725ae77Skettenis #include <sys/procfs.h> 41b725ae77Skettenis 42b725ae77Skettenis 43b725ae77Skettenis /* Error codes of the library. */ 44b725ae77Skettenis typedef enum 45b725ae77Skettenis { 46b725ae77Skettenis TD_OK, /* No error. */ 47b725ae77Skettenis TD_ERR, /* No further specified error. */ 48b725ae77Skettenis TD_NOTHR, /* No matching thread found. */ 49b725ae77Skettenis TD_NOSV, /* No matching synchronization handle found. */ 50b725ae77Skettenis TD_NOLWP, /* No matching light-weighted process found. */ 51b725ae77Skettenis TD_BADPH, /* Invalid process handle. */ 52b725ae77Skettenis TD_BADTH, /* Invalid thread handle. */ 53b725ae77Skettenis TD_BADSH, /* Invalid synchronization handle. */ 54b725ae77Skettenis TD_BADTA, /* Invalid thread agent. */ 55b725ae77Skettenis TD_BADKEY, /* Invalid key. */ 56b725ae77Skettenis TD_NOMSG, /* No event available. */ 57b725ae77Skettenis TD_NOFPREGS, /* No floating-point register content available. */ 58b725ae77Skettenis TD_NOLIBTHREAD, /* Application not linked with thread library. */ 59b725ae77Skettenis TD_NOEVENT, /* Requested event is not supported. */ 60b725ae77Skettenis TD_NOCAPAB, /* Capability not available. */ 61b725ae77Skettenis TD_DBERR, /* Internal debug library error. */ 62b725ae77Skettenis TD_NOAPLIC, /* Operation is not applicable. */ 63b725ae77Skettenis TD_NOTSD, /* No thread-specific data available. */ 64b725ae77Skettenis TD_MALLOC, /* Out of memory. */ 65b725ae77Skettenis TD_PARTIALREG, /* Not entire register set was read or written. */ 66b725ae77Skettenis TD_NOXREGS, /* X register set not available for given thread. */ 67b725ae77Skettenis TD_NOTALLOC /* TLS memory not yet allocated. */ 68b725ae77Skettenis } td_err_e; 69b725ae77Skettenis 70b725ae77Skettenis 71b725ae77Skettenis /* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to 72b725ae77Skettenis select threads regardless of state in td_ta_thr_iter(). */ 73b725ae77Skettenis typedef enum 74b725ae77Skettenis { 75b725ae77Skettenis TD_THR_ANY_STATE, 76b725ae77Skettenis TD_THR_UNKNOWN, 77b725ae77Skettenis TD_THR_STOPPED, 78b725ae77Skettenis TD_THR_RUN, 79b725ae77Skettenis TD_THR_ACTIVE, 80b725ae77Skettenis TD_THR_ZOMBIE, 81b725ae77Skettenis TD_THR_SLEEP, 82b725ae77Skettenis TD_THR_STOPPED_ASLEEP 83b725ae77Skettenis } td_thr_state_e; 84b725ae77Skettenis 85b725ae77Skettenis /* Thread type: user or system. TD_THR_ANY_TYPE is a pseudo-type used 86b725ae77Skettenis to select threads regardless of type in td_ta_thr_iter(). */ 87b725ae77Skettenis typedef enum 88b725ae77Skettenis { 89b725ae77Skettenis TD_THR_ANY_TYPE, 90b725ae77Skettenis TD_THR_USER, 91b725ae77Skettenis TD_THR_SYSTEM 92b725ae77Skettenis } td_thr_type_e; 93b725ae77Skettenis 94b725ae77Skettenis 95b725ae77Skettenis /* Types of the debugging library. */ 96b725ae77Skettenis 97b725ae77Skettenis /* Handle for a process. This type is opaque. */ 98b725ae77Skettenis typedef struct td_thragent td_thragent_t; 99b725ae77Skettenis 100b725ae77Skettenis /* The actual thread handle type. This is also opaque. */ 101b725ae77Skettenis typedef struct td_thrhandle 102b725ae77Skettenis { 103b725ae77Skettenis td_thragent_t *th_ta_p; 104b725ae77Skettenis psaddr_t th_unique; 105b725ae77Skettenis } td_thrhandle_t; 106b725ae77Skettenis 107b725ae77Skettenis 108b725ae77Skettenis /* Flags for `td_ta_thr_iter'. */ 109b725ae77Skettenis #define TD_THR_ANY_USER_FLAGS 0xffffffff 110b725ae77Skettenis #define TD_THR_LOWEST_PRIORITY -20 111b725ae77Skettenis #define TD_SIGNO_MASK NULL 112b725ae77Skettenis 113b725ae77Skettenis 114b725ae77Skettenis #define TD_EVENTSIZE 2 115b725ae77Skettenis #define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */ 116b725ae77Skettenis #define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */ 117b725ae77Skettenis #define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */ 118b725ae77Skettenis 119b725ae77Skettenis /* Bitmask of enabled events. */ 120b725ae77Skettenis typedef struct td_thr_events 121b725ae77Skettenis { 122b725ae77Skettenis gdb_uint32_t event_bits[TD_EVENTSIZE]; 123b725ae77Skettenis } td_thr_events_t; 124b725ae77Skettenis 125b725ae77Skettenis /* Event set manipulation macros. */ 126b725ae77Skettenis #define __td_eventmask(n) \ 127b725ae77Skettenis (GDB_UINT32_C (1) << (((n) - 1) & BT_UIMASK)) 128b725ae77Skettenis #define __td_eventword(n) \ 129b725ae77Skettenis ((GDB_UINT32_C ((n) - 1)) >> BT_UISHIFT) 130b725ae77Skettenis 131b725ae77Skettenis #define td_event_emptyset(setp) \ 132b725ae77Skettenis do { \ 133b725ae77Skettenis int __i; \ 134b725ae77Skettenis for (__i = TD_EVENTSIZE; __i > 0; --__i) \ 135b725ae77Skettenis (setp)->event_bits[__i - 1] = 0; \ 136b725ae77Skettenis } while (0) 137b725ae77Skettenis 138b725ae77Skettenis #define td_event_fillset(setp) \ 139b725ae77Skettenis do { \ 140b725ae77Skettenis int __i; \ 141b725ae77Skettenis for (__i = TD_EVENTSIZE; __i > 0; --__i) \ 142b725ae77Skettenis (setp)->event_bits[__i - 1] = GDB_UINT32_C (0xffffffff); \ 143b725ae77Skettenis } while (0) 144b725ae77Skettenis 145b725ae77Skettenis #define td_event_addset(setp, n) \ 146b725ae77Skettenis (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n)) 147b725ae77Skettenis #define td_event_delset(setp, n) \ 148b725ae77Skettenis (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n)) 149b725ae77Skettenis #define td_eventismember(setp, n) \ 150b725ae77Skettenis (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)])) 151b725ae77Skettenis #if TD_EVENTSIZE == 2 152b725ae77Skettenis # define td_eventisempty(setp) \ 153b725ae77Skettenis (!((setp)->event_bits[0]) && !((setp)->event_bits[1])) 154b725ae77Skettenis #else 155b725ae77Skettenis # error "td_eventisempty must be changed to match TD_EVENTSIZE" 156b725ae77Skettenis #endif 157b725ae77Skettenis 158b725ae77Skettenis /* Events reportable by the thread implementation. */ 159b725ae77Skettenis typedef enum 160b725ae77Skettenis { 161b725ae77Skettenis TD_ALL_EVENTS, /* Pseudo-event number. */ 162b725ae77Skettenis TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */ 163b725ae77Skettenis TD_READY, /* Is executable now. */ 164b725ae77Skettenis TD_SLEEP, /* Blocked in a synchronization obj. */ 165b725ae77Skettenis TD_SWITCHTO, /* Now assigned to a process. */ 166b725ae77Skettenis TD_SWITCHFROM, /* Not anymore assigned to a process. */ 167b725ae77Skettenis TD_LOCK_TRY, /* Trying to get an unavailable lock. */ 168b725ae77Skettenis TD_CATCHSIG, /* Signal posted to the thread. */ 169b725ae77Skettenis TD_IDLE, /* Process getting idle. */ 170b725ae77Skettenis TD_CREATE, /* New thread created. */ 171b725ae77Skettenis TD_DEATH, /* Thread terminated. */ 172b725ae77Skettenis TD_PREEMPT, /* Preempted. */ 173b725ae77Skettenis TD_PRI_INHERIT, /* Inherited elevated priority. */ 174b725ae77Skettenis TD_REAP, /* Reaped. */ 175b725ae77Skettenis TD_CONCURRENCY, /* Number of processes changing. */ 176b725ae77Skettenis TD_TIMEOUT, /* Conditional variable wait timed out. */ 177b725ae77Skettenis TD_MIN_EVENT_NUM = TD_READY, 178b725ae77Skettenis TD_MAX_EVENT_NUM = TD_TIMEOUT, 179b725ae77Skettenis TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */ 180b725ae77Skettenis } td_event_e; 181b725ae77Skettenis 182b725ae77Skettenis /* Values representing the different ways events are reported. */ 183b725ae77Skettenis typedef enum 184b725ae77Skettenis { 185b725ae77Skettenis NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */ 186b725ae77Skettenis NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically 187b725ae77Skettenis inserted. */ 188b725ae77Skettenis NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */ 189b725ae77Skettenis } td_notify_e; 190b725ae77Skettenis 191b725ae77Skettenis /* Description how event type is reported. */ 192b725ae77Skettenis typedef struct td_notify 193b725ae77Skettenis { 194b725ae77Skettenis td_notify_e type; /* Way the event is reported. */ 195b725ae77Skettenis union 196b725ae77Skettenis { 197b725ae77Skettenis psaddr_t bptaddr; /* Address of breakpoint. */ 198b725ae77Skettenis int syscallno; /* Number of system call used. */ 199b725ae77Skettenis } u; 200b725ae77Skettenis } td_notify_t; 201b725ae77Skettenis 202b725ae77Skettenis /* Some people still have libc5 or old glibc with no uintptr_t. 203b725ae77Skettenis They lose. glibc 2.1.3 was released on 2000-02-25, and it has 204b725ae77Skettenis uintptr_t, so it's reasonable to force these people to upgrade. */ 205b725ae77Skettenis 206b725ae77Skettenis #ifndef HAVE_UINTPTR_T 207b725ae77Skettenis #error No uintptr_t available; your C library is too old. 208b725ae77Skettenis /* Inhibit further compilation errors after this error. */ 209b725ae77Skettenis #define uintptr_t void * 210b725ae77Skettenis #endif 211b725ae77Skettenis 212b725ae77Skettenis /* Structure used to report event. */ 213b725ae77Skettenis typedef struct td_event_msg 214b725ae77Skettenis { 215b725ae77Skettenis td_event_e event; /* Event type being reported. */ 216b725ae77Skettenis const td_thrhandle_t *th_p; /* Thread reporting the event. */ 217b725ae77Skettenis union 218b725ae77Skettenis { 219b725ae77Skettenis #if 0 220b725ae77Skettenis td_synchandle_t *sh; /* Handle of synchronization object. */ 221b725ae77Skettenis #endif 222b725ae77Skettenis uintptr_t data; /* Event specific data. */ 223b725ae77Skettenis } msg; 224b725ae77Skettenis } td_event_msg_t; 225b725ae77Skettenis 226b725ae77Skettenis /* Structure containing event data available in each thread structure. */ 227b725ae77Skettenis typedef struct 228b725ae77Skettenis { 229b725ae77Skettenis td_thr_events_t eventmask; /* Mask of enabled events. */ 230b725ae77Skettenis td_event_e eventnum; /* Number of last event. */ 231b725ae77Skettenis void *eventdata; /* Data associated with event. */ 232b725ae77Skettenis } td_eventbuf_t; 233b725ae77Skettenis 234b725ae77Skettenis 235b725ae77Skettenis /* Gathered statistics about the process. */ 236b725ae77Skettenis typedef struct td_ta_stats 237b725ae77Skettenis { 238b725ae77Skettenis int nthreads; /* Total number of threads in use. */ 239b725ae77Skettenis int r_concurrency; /* Concurrency level requested by user. */ 240b725ae77Skettenis int nrunnable_num; /* Average runnable threads, numerator. */ 241b725ae77Skettenis int nrunnable_den; /* Average runnable threads, denominator. */ 242b725ae77Skettenis int a_concurrency_num; /* Achieved concurrency level, numerator. */ 243b725ae77Skettenis int a_concurrency_den; /* Achieved concurrency level, denominator. */ 244b725ae77Skettenis int nlwps_num; /* Average number of processes in use, 245b725ae77Skettenis numerator. */ 246b725ae77Skettenis int nlwps_den; /* Average number of processes in use, 247b725ae77Skettenis denominator. */ 248b725ae77Skettenis int nidle_num; /* Average number of idling processes, 249b725ae77Skettenis numerator. */ 250b725ae77Skettenis int nidle_den; /* Average number of idling processes, 251b725ae77Skettenis denominator. */ 252b725ae77Skettenis } td_ta_stats_t; 253b725ae77Skettenis 254b725ae77Skettenis 255b725ae77Skettenis /* Since Sun's library is based on Solaris threads we have to define a few 256b725ae77Skettenis types to map them to POSIX threads. */ 257b725ae77Skettenis typedef pthread_t thread_t; 258b725ae77Skettenis typedef pthread_key_t thread_key_t; 259b725ae77Skettenis 260b725ae77Skettenis 261b725ae77Skettenis /* Callback for iteration over threads. */ 262b725ae77Skettenis typedef int td_thr_iter_f (const td_thrhandle_t *, void *); 263b725ae77Skettenis 264b725ae77Skettenis /* Callback for iteration over thread local data. */ 265b725ae77Skettenis typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *); 266b725ae77Skettenis 267b725ae77Skettenis 268b725ae77Skettenis 269b725ae77Skettenis /* Forward declaration. This has to be defined by the user. */ 270b725ae77Skettenis struct ps_prochandle; 271b725ae77Skettenis 272b725ae77Skettenis 273b725ae77Skettenis /* Information about the thread. */ 274b725ae77Skettenis typedef struct td_thrinfo 275b725ae77Skettenis { 276b725ae77Skettenis td_thragent_t *ti_ta_p; /* Process handle. */ 277b725ae77Skettenis unsigned int ti_user_flags; /* Unused. */ 278b725ae77Skettenis thread_t ti_tid; /* Thread ID returned by 279b725ae77Skettenis pthread_create(). */ 280b725ae77Skettenis char *ti_tls; /* Pointer to thread-local data. */ 281b725ae77Skettenis psaddr_t ti_startfunc; /* Start function passed to 282b725ae77Skettenis pthread_create(). */ 283b725ae77Skettenis psaddr_t ti_stkbase; /* Base of thread's stack. */ 284b725ae77Skettenis long int ti_stksize; /* Size of thread's stack. */ 285b725ae77Skettenis psaddr_t ti_ro_area; /* Unused. */ 286b725ae77Skettenis int ti_ro_size; /* Unused. */ 287b725ae77Skettenis td_thr_state_e ti_state; /* Thread state. */ 288b725ae77Skettenis unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */ 289b725ae77Skettenis td_thr_type_e ti_type; /* Type of the thread (system vs 290b725ae77Skettenis user thread). */ 291b725ae77Skettenis intptr_t ti_pc; /* Unused. */ 292b725ae77Skettenis intptr_t ti_sp; /* Unused. */ 293b725ae77Skettenis short int ti_flags; /* Unused. */ 294b725ae77Skettenis int ti_pri; /* Thread priority. */ 295*11efff7fSkettenis lwpid_t ti_lid; /* Kernel pid for this thread. */ 296b725ae77Skettenis sigset_t ti_sigmask; /* Signal mask. */ 297b725ae77Skettenis unsigned char ti_traceme; /* Nonzero if event reporting 298b725ae77Skettenis enabled. */ 299b725ae77Skettenis unsigned char ti_preemptflag; /* Unused. */ 300b725ae77Skettenis unsigned char ti_pirecflag; /* Unused. */ 301b725ae77Skettenis sigset_t ti_pending; /* Set of pending signals. */ 302b725ae77Skettenis td_thr_events_t ti_events; /* Set of enabled events. */ 303b725ae77Skettenis } td_thrinfo_t; 304b725ae77Skettenis 305b725ae77Skettenis 306b725ae77Skettenis 307b725ae77Skettenis /* Prototypes for exported library functions. */ 308b725ae77Skettenis 309b725ae77Skettenis /* Initialize the thread debug support library. */ 310b725ae77Skettenis extern td_err_e td_init (void); 311b725ae77Skettenis 312b725ae77Skettenis /* Historical relict. Should not be used anymore. */ 313b725ae77Skettenis extern td_err_e td_log (void); 314b725ae77Skettenis 315b725ae77Skettenis /* Generate new thread debug library handle for process PS. */ 316b725ae77Skettenis extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta); 317b725ae77Skettenis 318b725ae77Skettenis /* Free resources allocated for TA. */ 319b725ae77Skettenis extern td_err_e td_ta_delete (td_thragent_t *__ta); 320b725ae77Skettenis 321b725ae77Skettenis /* Get number of currently running threads in process associated with TA. */ 322b725ae77Skettenis extern td_err_e td_ta_get_nthreads (const td_thragent_t *__ta, int *__np); 323b725ae77Skettenis 324b725ae77Skettenis /* Return process handle passed in `td_ta_new' for process associated with 325b725ae77Skettenis TA. */ 326b725ae77Skettenis extern td_err_e td_ta_get_ph (const td_thragent_t *__ta, 327b725ae77Skettenis struct ps_prochandle **__ph); 328b725ae77Skettenis 329b725ae77Skettenis /* Map thread library handle PT to thread debug library handle for process 330b725ae77Skettenis associated with TA and store result in *TH. */ 331b725ae77Skettenis extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt, 332b725ae77Skettenis td_thrhandle_t *__th); 333b725ae77Skettenis 334b725ae77Skettenis /* Map process ID LWPID to thread debug library handle for process 335b725ae77Skettenis associated with TA and store result in *TH. */ 336b725ae77Skettenis extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid, 337b725ae77Skettenis td_thrhandle_t *__th); 338b725ae77Skettenis 339b725ae77Skettenis 340b725ae77Skettenis /* Call for each thread in a process associated with TA the callback function 341b725ae77Skettenis CALLBACK. */ 342b725ae77Skettenis extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta, 343b725ae77Skettenis td_thr_iter_f *__callback, void *__cbdata_p, 344b725ae77Skettenis td_thr_state_e __state, int __ti_pri, 345b725ae77Skettenis sigset_t *__ti_sigmask_p, 346b725ae77Skettenis unsigned int __ti_user_flags); 347b725ae77Skettenis 348b725ae77Skettenis /* Call for each defined thread local data entry the callback function KI. */ 349b725ae77Skettenis extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki, 350b725ae77Skettenis void *__p); 351b725ae77Skettenis 352b725ae77Skettenis 353b725ae77Skettenis /* Get event address for EVENT. */ 354b725ae77Skettenis extern td_err_e td_ta_event_addr (const td_thragent_t *__ta, 355b725ae77Skettenis td_event_e __event, td_notify_t *__ptr); 356b725ae77Skettenis 357b725ae77Skettenis /* Enable EVENT in global mask. */ 358b725ae77Skettenis extern td_err_e td_ta_set_event (const td_thragent_t *__ta, 359b725ae77Skettenis td_thr_events_t *__event); 360b725ae77Skettenis 361b725ae77Skettenis /* Disable EVENT in global mask. */ 362b725ae77Skettenis extern td_err_e td_ta_clear_event (const td_thragent_t *__ta, 363b725ae77Skettenis td_thr_events_t *__event); 364b725ae77Skettenis 365b725ae77Skettenis /* Return information about last event. */ 366b725ae77Skettenis extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta, 367b725ae77Skettenis td_event_msg_t *msg); 368b725ae77Skettenis 369b725ae77Skettenis 370b725ae77Skettenis /* Set suggested concurrency level for process associated with TA. */ 371b725ae77Skettenis extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level); 372b725ae77Skettenis 373b725ae77Skettenis 374b725ae77Skettenis /* Enable collecting statistics for process associated with TA. */ 375b725ae77Skettenis extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable); 376b725ae77Skettenis 377b725ae77Skettenis /* Reset statistics. */ 378b725ae77Skettenis extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta); 379b725ae77Skettenis 380b725ae77Skettenis /* Retrieve statistics from process associated with TA. */ 381b725ae77Skettenis extern td_err_e td_ta_get_stats (const td_thragent_t *__ta, 382b725ae77Skettenis td_ta_stats_t *__statsp); 383b725ae77Skettenis 384b725ae77Skettenis 385b725ae77Skettenis /* Validate that TH is a thread handle. */ 386b725ae77Skettenis extern td_err_e td_thr_validate (const td_thrhandle_t *__th); 387b725ae77Skettenis 388b725ae77Skettenis /* Return information about thread TH. */ 389b725ae77Skettenis extern td_err_e td_thr_get_info (const td_thrhandle_t *__th, 390b725ae77Skettenis td_thrinfo_t *__infop); 391b725ae77Skettenis 392b725ae77Skettenis /* Retrieve floating-point register contents of process running thread TH. */ 393b725ae77Skettenis extern td_err_e td_thr_getfpregs (const td_thrhandle_t *__th, 394b725ae77Skettenis prfpregset_t *__regset); 395b725ae77Skettenis 396b725ae77Skettenis /* Retrieve general register contents of process running thread TH. */ 397b725ae77Skettenis extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th, 398b725ae77Skettenis prgregset_t __gregs); 399b725ae77Skettenis 400b725ae77Skettenis /* Retrieve extended register contents of process running thread TH. */ 401b725ae77Skettenis extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs); 402b725ae77Skettenis 403b725ae77Skettenis /* Get size of extended register set of process running thread TH. */ 404b725ae77Skettenis extern td_err_e td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep); 405b725ae77Skettenis 406b725ae77Skettenis /* Set floating-point register contents of process running thread TH. */ 407b725ae77Skettenis extern td_err_e td_thr_setfpregs (const td_thrhandle_t *__th, 408b725ae77Skettenis const prfpregset_t *__fpregs); 409b725ae77Skettenis 410b725ae77Skettenis /* Set general register contents of process running thread TH. */ 411b725ae77Skettenis extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th, 412b725ae77Skettenis prgregset_t __gregs); 413b725ae77Skettenis 414b725ae77Skettenis /* Set extended register contents of process running thread TH. */ 415b725ae77Skettenis extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th, 416b725ae77Skettenis const void *__addr); 417b725ae77Skettenis 418b725ae77Skettenis 419b725ae77Skettenis /* Enable reporting for EVENT for thread TH. */ 420b725ae77Skettenis extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event); 421b725ae77Skettenis 422b725ae77Skettenis /* Enable EVENT for thread TH. */ 423b725ae77Skettenis extern td_err_e td_thr_set_event (const td_thrhandle_t *__th, 424b725ae77Skettenis td_thr_events_t *__event); 425b725ae77Skettenis 426b725ae77Skettenis /* Disable EVENT for thread TH. */ 427b725ae77Skettenis extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th, 428b725ae77Skettenis td_thr_events_t *__event); 429b725ae77Skettenis 430b725ae77Skettenis /* Get event message for thread TH. */ 431b725ae77Skettenis extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th, 432b725ae77Skettenis td_event_msg_t *__msg); 433b725ae77Skettenis 434b725ae77Skettenis 435b725ae77Skettenis /* Set priority of thread TH. */ 436b725ae77Skettenis extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio); 437b725ae77Skettenis 438b725ae77Skettenis 439b725ae77Skettenis /* Set pending signals for thread TH. */ 440b725ae77Skettenis extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th, 441b725ae77Skettenis unsigned char __n, const sigset_t *__ss); 442b725ae77Skettenis 443b725ae77Skettenis /* Set signal mask for thread TH. */ 444b725ae77Skettenis extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th, 445b725ae77Skettenis const sigset_t *__ss); 446b725ae77Skettenis 447b725ae77Skettenis 448b725ae77Skettenis /* Return thread local data associated with key TK in thread TH. */ 449b725ae77Skettenis extern td_err_e td_thr_tsd (const td_thrhandle_t *__th, 450b725ae77Skettenis const thread_key_t __tk, void **__data); 451b725ae77Skettenis 452b725ae77Skettenis 453b725ae77Skettenis /* Suspend execution of thread TH. */ 454b725ae77Skettenis extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th); 455b725ae77Skettenis 456b725ae77Skettenis /* Resume execution of thread TH. */ 457b725ae77Skettenis extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th); 458b725ae77Skettenis 459b725ae77Skettenis #endif /* thread_db.h */ 460b725ae77Skettenis 461b725ae77Skettenis #endif /* HAVE_THREAD_DB_H */ 462