#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
+#ifndef LIBTHREAD_DB_SO
+#define LIBTHREAD_DB_SO "libthread_db.so.1"
#endif
-/* Copyright 1999, 2000 Free Software Foundation, Inc.
+#ifndef LIBTHREAD_DB_SEARCH_PATH
+#define LIBTHREAD_DB_SEARCH_PATH ""
+#endif
+
+#else
+
+/* Copyright (C) 1999, 2000, 2007, 2008, 2009, 2010, 2011
+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
modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _THREAD_DB_H
#define _THREAD_DB_H 1
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_NOXREGS, /* X register set not available for given thread. */
+ TD_NOTALLOC /* TLS memory not yet allocated. */
} td_err_e;
#define TD_EVENTSIZE 2
-#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */
-#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */
-#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
+#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to
+ extract word index. */
+#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint. */
+#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index. */
-/* Bitmask of enabled events. */
+/* Bitmask of enabled events. */
typedef struct td_thr_events
{
- gdb_uint32_t event_bits[TD_EVENTSIZE];
+ uint32_t event_bits[TD_EVENTSIZE];
} td_thr_events_t;
-/* Event set manipulation macros. */
+/* Event set manipulation macros. */
#define __td_eventmask(n) \
- (GDB_UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+ (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
#define __td_eventword(n) \
- ((GDB_UINT32_C ((n) - 1)) >> BT_UISHIFT)
+ ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
#define td_event_emptyset(setp) \
do { \
do { \
int __i; \
for (__i = TD_EVENTSIZE; __i > 0; --__i) \
- (setp)->event_bits[__i - 1] = GDB_UINT32_C (0xffffffff); \
+ (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \
} while (0)
#define td_event_addset(setp, n) \
{
TD_ALL_EVENTS, /* Pseudo-event number. */
TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */
- TD_READY, /* Is executable now. */
+ TD_READY, /* Is executable now. */
TD_SLEEP, /* Blocked in a synchronization obj. */
TD_SWITCHTO, /* Now assigned to a process. */
TD_SWITCHFROM, /* Not anymore assigned to a process. */
/* Values representing the different ways events are reported. */
typedef enum
{
- NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */
+ NOTIFY_BPT, /* User must insert breakpoint at
+ u.bptaddr. */
NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically
inserted. */
NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */
} 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
{
psaddr_t ti_ro_area; /* Unused. */
int ti_ro_size; /* Unused. */
td_thr_state_e ti_state; /* Thread state. */
- unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */
+ unsigned char ti_db_suspended; /* Nonzero if suspended by
+ debugger. */
td_thr_type_e ti_type; /* Type of the thread (system vs
user thread). */
intptr_t ti_pc; /* Unused. */
intptr_t ti_sp; /* Unused. */
short int ti_flags; /* Unused. */
int ti_pri; /* Thread priority. */
- lwpid_t ti_lid; /* Unused. */
+ lwpid_t ti_lid; /* Kernel pid for this thread. */
sigset_t ti_sigmask; /* Signal mask. */
unsigned char ti_traceme; /* Nonzero if event reporting
enabled. */