aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdb_thread_db.h
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2000-09-03 12:06:58 +0000
committerMark Kettenis <kettenis@gnu.org>2000-09-03 12:06:58 +0000
commit574dd9a99834c6fcefe5f1ee5d4864433305dc42 (patch)
tree4f4e522a28d1921833b5873fbc45de62cc42eb42 /gdb/gdb_thread_db.h
parent110be7c974fa48040bd00ed8a7b154cca1ba8cb3 (diff)
downloadgdb-574dd9a99834c6fcefe5f1ee5d4864433305dc42.zip
gdb-574dd9a99834c6fcefe5f1ee5d4864433305dc42.tar.gz
gdb-574dd9a99834c6fcefe5f1ee5d4864433305dc42.tar.bz2
* gdb_thread_db.h [HAVE_THREAD_DB_H]: Include <thread_db.h>.
[!HAVE_THREAD_DB_H]: Update from current glibc thread_db.h. Deal with absence of <stdint.h> here.
Diffstat (limited to 'gdb/gdb_thread_db.h')
-rw-r--r--gdb/gdb_thread_db.h105
1 files changed, 64 insertions, 41 deletions
diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h
index 5bb1963..8c868c2 100644
--- a/gdb/gdb_thread_db.h
+++ b/gdb/gdb_thread_db.h
@@ -1,3 +1,16 @@
+#ifdef HAVE_THREAD_DB_H
+#include <thread_db.h>
+#else
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+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 (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -23,35 +36,34 @@
modelled closely after the interface with same names in Solaris with
the goal to share the same code in the debugger. */
#include <pthread.h>
-#include <stdint.h>
#include <sys/types.h>
-/*#include <sys/ucontext.h>*/
+#include <sys/procfs.h>
/* 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_err_e;
@@ -81,9 +93,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 +118,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 +138,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) \
@@ -196,13 +205,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 +246,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 +343,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 +446,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 */