1999-10-08 15:03:03 +08:00
|
|
|
/* Private header for thread debug library. */
|
|
|
|
#ifndef _THREAD_DBP_H
|
|
|
|
#define _THREAD_DBP_H 1
|
|
|
|
|
1999-10-13 00:00:04 +08:00
|
|
|
#include <string.h>
|
2002-03-04 03:43:30 +08:00
|
|
|
#include <unistd.h>
|
1999-11-03 00:04:00 +08:00
|
|
|
#include "proc_service.h"
|
1999-10-08 15:03:03 +08:00
|
|
|
#include "thread_db.h"
|
2002-02-05 08:57:29 +08:00
|
|
|
#include "../linuxthreads/descr.h"
|
1999-10-08 15:03:03 +08:00
|
|
|
|
|
|
|
|
2001-03-21 05:05:29 +08:00
|
|
|
/* Indeces for the symbol names. */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PTHREAD_THREADS_EVENTS = 0,
|
|
|
|
PTHREAD_LAST_EVENT,
|
|
|
|
PTHREAD_HANDLES_NUM,
|
|
|
|
PTHREAD_HANDLES,
|
|
|
|
PTHREAD_KEYS,
|
|
|
|
LINUXTHREADS_PTHREAD_THREADS_MAX,
|
|
|
|
LINUXTHREADS_PTHREAD_KEYS_MAX,
|
|
|
|
LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
|
|
|
|
LINUXTHREADS_CREATE_EVENT,
|
|
|
|
LINUXTHREADS_DEATH_EVENT,
|
|
|
|
LINUXTHREADS_REAP_EVENT,
|
2002-08-08 14:38:19 +08:00
|
|
|
LINUXTHREADS_INITIAL_REPORT_EVENTS,
|
2002-08-24 11:35:35 +08:00
|
|
|
LINUXTHREADS_VERSION,
|
2001-03-21 05:05:29 +08:00
|
|
|
NUM_MESSAGES
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-10-08 15:03:03 +08:00
|
|
|
/* Comment out the following for less verbose output. */
|
1999-11-23 04:53:18 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
# define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
|
|
|
|
extern int __td_debug;
|
|
|
|
#else
|
|
|
|
# define LOG(c)
|
|
|
|
#endif
|
1999-10-08 15:03:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Handle for a process. This type is opaque. */
|
|
|
|
struct td_thragent
|
|
|
|
{
|
|
|
|
/* Delivered by the debugger and we have to pass it back in the
|
|
|
|
proc callbacks. */
|
|
|
|
struct ps_prochandle *ph;
|
|
|
|
|
|
|
|
/* Some cached information. */
|
|
|
|
|
|
|
|
/* Address of the `__pthread_handles' array. */
|
|
|
|
struct pthread_handle_struct *handles;
|
|
|
|
|
|
|
|
/* Address of the `pthread_kyes' array. */
|
|
|
|
struct pthread_key_struct *keys;
|
|
|
|
|
|
|
|
/* Maximum number of threads. */
|
|
|
|
int pthread_threads_max;
|
|
|
|
|
|
|
|
/* Maximum number of thread-local data keys. */
|
|
|
|
int pthread_keys_max;
|
|
|
|
|
|
|
|
/* Size of 2nd level array for thread-local data keys. */
|
|
|
|
int pthread_key_2ndlevel_size;
|
|
|
|
|
|
|
|
/* Sizeof struct _pthread_descr_struct. */
|
|
|
|
int sizeof_descr;
|
1999-11-03 07:44:42 +08:00
|
|
|
|
|
|
|
/* Pointer to the `__pthread_threads_events' variable in the target. */
|
|
|
|
psaddr_t pthread_threads_eventsp;
|
1999-11-03 14:13:09 +08:00
|
|
|
|
|
|
|
/* Pointer to the `__pthread_last_event' variable in the target. */
|
|
|
|
psaddr_t pthread_last_event;
|
|
|
|
|
|
|
|
/* Pointer to the `__pthread_handles_num' variable. */
|
|
|
|
psaddr_t pthread_handles_num;
|
1999-10-08 15:03:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-11-05 10:26:16 +08:00
|
|
|
/* Type used internally to keep track of thread agent descriptors. */
|
|
|
|
struct agent_list
|
|
|
|
{
|
|
|
|
td_thragent_t *ta;
|
|
|
|
struct agent_list *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* List of all known descriptors. */
|
|
|
|
extern struct agent_list *__td_agent_list;
|
|
|
|
|
|
|
|
/* Function used to test for correct thread agent pointer. */
|
|
|
|
static inline int
|
|
|
|
ta_ok (const td_thragent_t *ta)
|
|
|
|
{
|
|
|
|
struct agent_list *runp = __td_agent_list;
|
|
|
|
|
|
|
|
if (ta == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while (runp != NULL && runp->ta != ta)
|
|
|
|
runp = runp->next;
|
|
|
|
|
|
|
|
return runp != NULL;
|
|
|
|
}
|
|
|
|
|
2001-03-21 05:05:29 +08:00
|
|
|
|
|
|
|
/* Internal wrapper around ps_pglobal_lookup. */
|
|
|
|
extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
|
|
|
|
|
1999-10-08 15:03:03 +08:00
|
|
|
#endif /* thread_dbP.h */
|