X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fgdb_thread_db.h;h=81dd0a062db6299ffccdea62029306c813ffc3b4;hb=b9ff3018cd573e009421f7aa357ebba6345adf42;hp=5bb196344b121e7e893e43b325267f1d8e0fefae;hpb=ed9a39ebf9f55562c7c582155f6721c3e685ce91;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h index 5bb196344b..81dd0a062d 100644 --- a/gdb/gdb_thread_db.h +++ b/gdb/gdb_thread_db.h @@ -1,4 +1,17 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +#ifdef HAVE_THREAD_DB_H +#include +#else + +#ifdef HAVE_STDINT_H +#include +typedef uint32_t gdb_uint32_t; +#define GDB_UINT32_C(c) UINT32_C(c) +#else +typedef unsigned int gdb_uint32_t; +#define GDB_UINT32_C(c) c ## U +#endif + +/* Copyright 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,35 +36,35 @@ modelled closely after the interface with same names in Solaris with the goal to share the same code in the debugger. */ #include -#include #include -/*#include */ +#include /* Error codes of the library. */ typedef enum { - TD_OK, /* No error. */ - TD_ERR, /* No further specified error. */ - TD_NOTHR, /* No matching thread found. */ - TD_NOSV, /* No matching synchronization handle found. */ - TD_NOLWP, /* No matching light-weighted process found. */ - TD_BADPH, /* Invalid process handle. */ - TD_BADTH, /* Invalid thread handle. */ - TD_BADSH, /* Invalid synchronization handle. */ - TD_BADTA, /* Invalid thread agent. */ - TD_BADKEY, /* Invalid key. */ - TD_NOMSG, /* No event available. */ - TD_NOFPREGS, /* No floating-point register content available. */ - TD_NOLIBTHREAD, /* Application not linked with thread library. */ - TD_NOEVENT, /* Requested event is not supported. */ - TD_NOCAPAB, /* Capability not available. */ - TD_DBERR, /* Internal debug library error. */ - TD_NOAPLIC, /* Operation is not applicable. */ - TD_NOTSD, /* No thread-specific data available. */ - TD_MALLOC, /* Out of memory. */ - TD_PARTIALREG,/* Not entire register set was read or written. */ - TD_NOXREGS /* X register set not available for given thread. */ + TD_OK, /* No error. */ + TD_ERR, /* No further specified error. */ + TD_NOTHR, /* No matching thread found. */ + TD_NOSV, /* No matching synchronization handle found. */ + TD_NOLWP, /* No matching light-weighted process found. */ + TD_BADPH, /* Invalid process handle. */ + TD_BADTH, /* Invalid thread handle. */ + TD_BADSH, /* Invalid synchronization handle. */ + TD_BADTA, /* Invalid thread agent. */ + TD_BADKEY, /* Invalid key. */ + TD_NOMSG, /* No event available. */ + TD_NOFPREGS, /* No floating-point register content available. */ + TD_NOLIBTHREAD, /* Application not linked with thread library. */ + TD_NOEVENT, /* Requested event is not supported. */ + TD_NOCAPAB, /* Capability not available. */ + TD_DBERR, /* Internal debug library error. */ + TD_NOAPLIC, /* Operation is not applicable. */ + TD_NOTSD, /* No thread-specific data available. */ + TD_MALLOC, /* Out of memory. */ + TD_PARTIALREG, /* Not entire register set was read or written. */ + TD_NOXREGS, /* X register set not available for given thread. */ + TD_NOTALLOC /* TLS memory not yet allocated. */ } td_err_e; @@ -81,9 +94,6 @@ typedef enum /* Types of the debugging library. */ -/* Addresses. */ -/*typedef void *psaddr_t;*/ - /* Handle for a process. This type is opaque. */ typedef struct td_thragent td_thragent_t; @@ -109,14 +119,14 @@ typedef struct td_thrhandle /* Bitmask of enabled events. */ typedef struct td_thr_events { - uint32_t event_bits[TD_EVENTSIZE]; + gdb_uint32_t event_bits[TD_EVENTSIZE]; } td_thr_events_t; /* Event set manipulation macros. */ #define __td_eventmask(n) \ - (UINT32_C (1) << (((n) - 1) & BT_UIMASK)) + (GDB_UINT32_C (1) << (((n) - 1) & BT_UIMASK)) #define __td_eventword(n) \ - ((UINT32_C ((n) - 1)) >> BT_UISHIFT) + ((GDB_UINT32_C ((n) - 1)) >> BT_UISHIFT) #define td_event_emptyset(setp) \ do { \ @@ -129,7 +139,7 @@ typedef struct td_thr_events do { \ int __i; \ for (__i = TD_EVENTSIZE; __i > 0; --__i) \ - (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \ + (setp)->event_bits[__i - 1] = GDB_UINT32_C (0xffffffff); \ } while (0) #define td_event_addset(setp, n) \ @@ -189,6 +199,16 @@ typedef struct td_notify } u; } td_notify_t; +/* Some people still have libc5 or old glibc with no uintptr_t. + They lose. glibc 2.1.3 was released on 2000-02-25, and it has + uintptr_t, so it's reasonable to force these people to upgrade. */ + +#ifndef HAVE_UINTPTR_T +#error No uintptr_t available; your C library is too old. +/* Inhibit further compilation errors after this error. */ +#define uintptr_t void * +#endif + /* Structure used to report event. */ typedef struct td_event_msg { @@ -196,13 +216,21 @@ typedef struct td_event_msg const td_thrhandle_t *th_p; /* Thread reporting the event. */ union { -# if 0 +#if 0 td_synchandle_t *sh; /* Handle of synchronization object. */ #endif uintptr_t data; /* Event specific data. */ } msg; } td_event_msg_t; +/* Structure containing event data available in each thread structure. */ +typedef struct +{ + td_thr_events_t eventmask; /* Mask of enabled events. */ + td_event_e eventnum; /* Number of last event. */ + void *eventdata; /* Data associated with event. */ +} td_eventbuf_t; + /* Gathered statistics about the process. */ typedef struct td_ta_stats @@ -229,26 +257,18 @@ typedef struct td_ta_stats typedef pthread_t thread_t; typedef pthread_key_t thread_key_t; -/* Linux has different names for the register set types. */ -/*typedef gregset_t prgregset_t;*/ -/*typedef fpregset_t prfpregset_t;*/ - /* Callback for iteration over threads. */ -typedef int td_thr_iter_f __P ((const td_thrhandle_t *, void *)); +typedef int td_thr_iter_f (const td_thrhandle_t *, void *); /* Callback for iteration over thread local data. */ -typedef int td_key_iter_f __P ((thread_key_t, void (*) (void *), void *)); +typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *); /* Forward declaration. This has to be defined by the user. */ struct ps_prochandle; -/* We don't have any differences between processes and threads, therefore - have only one PID type. */ -/*typedef pid_t lwpid_t;*/ - /* Information about the thread. */ typedef struct td_thrinfo @@ -334,6 +354,18 @@ extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki, extern td_err_e td_ta_event_addr (const td_thragent_t *__ta, td_event_e __event, td_notify_t *__ptr); +/* Enable EVENT in global mask. */ +extern td_err_e td_ta_set_event (const td_thragent_t *__ta, + td_thr_events_t *__event); + +/* Disable EVENT in global mask. */ +extern td_err_e td_ta_clear_event (const td_thragent_t *__ta, + td_thr_events_t *__event); + +/* Return information about last event. */ +extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta, + td_event_msg_t *msg); + /* Set suggested concurrency level for process associated with TA. */ extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level); @@ -425,3 +457,5 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th); extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th); #endif /* thread_db.h */ + +#endif /* HAVE_THREAD_DB_H */