/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _THREAD_DB_H
#define _THREAD_DB_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* Description:
* Types, global variables, and function definitions for users
* of libc_db (formerly libthread_db).
*
*/
#include <sys/procfs_isa.h>
#include <thread.h>
#include <proc_service.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TD_SIGNO_MASK 0
/*
* Opaque handle types.
*/
/* Client's handle for a process */
struct ps_prochandle;
/* libthread's handle for a process */
/* The thread handle. */
typedef struct td_thrhandle {
/* The handle for a synchronization object. */
typedef struct td_synchandle {
/* ------------------------------------------------------------------ */
/*
* The libc_db event facility.
*/
/* Bitmask of enabled events. */
typedef struct td_thr_events {
/* Event set manipulation macros. */
& (BT_NBIPUI - 1)))
{ \
int _i_; \
_i_ = TD_EVENTSIZE; \
}
{ \
int _i_; \
_i_ = TD_EVENTSIZE; \
0xffffffff; \
}
typedef enum {
} td_event_e;
/*
* Ways that an event type can be reported.
*/
typedef enum {
/*
* bpt to be inserted at u.bptaddr by
* debugger
*/
} td_notify_e;
/*
* How an event type is reported.
*/
typedef struct td_notify {
union {
int syscallno;
} u;
} td_notify_t;
/*
* An event message.
*/
typedef struct td_event_msg {
union { /* Type-dependent event data */
} msg;
/* --------------------------------------------------------------------- */
/*
* Thread information structure as returned by td_thr_get_info(), and
* related types.
*/
/*
* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used
* to select threads regardless of state in td_ta_thr_iter().
*/
typedef enum {
/*
* Thread type: user or system.
* As of Solaris 9, all threads are type TD_THR_USER.
*/
typedef enum {
typedef struct td_thrinfo {
} td_thrinfo_t;
typedef struct td_ta_stats {
/*
* Iterator callback function declarations.
*/
/* Callback function for td_ta_tsd_iter(). */
/* Callback function for td_ta_thr_iter(). */
/* Callback function for td_ta_sync_iter(). */
/* -------------------------------------------------------------------- */
/*
* Synchronization Objects
*/
/* Enumeration of synchronization object types. */
typedef enum td_sync_type_e {
/*
* Synchronization object information structure filled in by td_sync_get_info()
*/
typedef struct td_syncinfo {
union _si_un_state {
} si_state;
/*
* Statistics structures for the various synchronization objects, contained
* within the td_syncstats structure returned by td_sync_get_stats().
*/
typedef struct {
typedef struct {
typedef struct {
typedef struct {
/*
* Synchronization object statistics structure filled in by td_sync_get_stats()
*/
typedef struct td_syncstats {
union {
} ss_un;
/* The set of error codes. */
typedef enum {
} td_err_e;
/* ----------------------------------------------------------------------- */
/*
* Exported functions.
*/
/*
* Initialize the threads debug interface.
*/
td_init(void);
/*
* A no-op, left for historical reasons.
*/
void
td_log(void);
/*
* Allocate a new process handle ("thread agent").
*/
/*
* De-allocate a process handle, releasing all related resources.
*/
/*
* Map a process handle to a client process handle.
*/
/*
* Set the process's suggested concurrency level.
*/
td_ta_setconcurrency(const td_thragent_t *, int);
/*
* Get the number of threads in the process, including zombie threads.
*/
td_ta_get_nthreads(const td_thragent_t *, int *);
/*
* Map a tid, as returned by thr_create(), to a thread handle.
*/
/*
* Map the address of a synchronization object to a sync. object handle.
*/
/*
* Iterate over a process's thread-specific data (TSD) keys.
*/
/*
* Iterate over a process's threads, including zombie threads.
*/
td_thr_state_e, int, sigset_t *, unsigned);
/*
* Iterate over a process's known synchronization objects.
*/
/*
*/
td_ta_enable_stats(const td_thragent_t *, int);
/*
* Reset process statistics.
*/
td_ta_reset_stats(const td_thragent_t *);
/*
* Read process statistics.
*/
/*
* Get thread information.
*/
/*
* Get the "event address" for an event type.
*/
/*
*/
td_thr_event_enable(const td_thrhandle_t *, int);
/*
* Enable a set of events for a thread.
*/
/*
* Disable a set of events for a thread.
*/
/*
* Retrieve (and consume) an event message for a thread.
*/
/*
* Enable a set of events in the process.
*/
/*
* Disable a set of events in the process.
*/
/*
* Retrieve (and consume) an event message for some thread in the process.
*/
/*
* Suspend a thread.
*/
td_thr_dbsuspend(const td_thrhandle_t *);
/*
* Resume a suspended thread.
*/
td_thr_dbresume(const td_thrhandle_t *);
/*
* Set a thread's signal mask.
*/
/*
* Set a thread's "signals-pending" set.
*/
/*
* Get a thread's general register set.
*/
/*
* Set a thread's general register set.
*/
/*
* Get a thread's floating-point register set.
*/
/*
* Set a thread's floating-point register set.
*/
/*
* Get the size of the extra state register set for this architecture.
*/
/*
* Get a thread's extra state register set.
*/
/*
* Set a thread's extra state register set.
*/
/*
* Validate a thread handle.
*/
td_thr_validate(const td_thrhandle_t *);
/*
* Get a thread-specific data pointer for a thread.
*/
/*
* Get the base address of a thread's thread local storage (TLS) block
* for the module (executable or shared object) identified by 'moduleid'.
*/
/*
* Set a thread's priority.
*/
td_thr_setprio(const td_thrhandle_t *, int);
/*
* Iterate over the set of locks owned by a thread.
*/
/*
* Return the sync. handle of the object this thread is sleeping on.
*/
/*
* Map an lwpid, as returned by _lwp_create(), to a thread handle.
*/
/*
*/
td_ta_sync_tracking_enable(const td_thragent_t *, int);
/*
* Get information about a synchronization object.
*/
/*
* Get statistics for a synchronization object.
*/
/*
* Set the state of a synchronization object.
*/
/*
* Iterate over all threads blocked on a synchronization object.
*/
#ifdef __cplusplus
}
#endif
#endif /* _THREAD_DB_H */