Update glibc_thread_db.h from upstream.

Attempting to build gdbserver with our copy of thread_db.h yields:

In file included from ../../../src/gdb/gdbserver/../common/gdb_thread_db.h:4:0,
                 from ../../../src/gdb/gdbserver/thread-db.c:30:
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:108:3: error: unknown type name ‘uint32_t’
In file included from ../../../src/gdb/gdbserver/../common/gdb_thread_db.h:4:0,
                 from ../../../src/gdb/gdbserver/thread-db.c:30:
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:199:5: error: unknown type name ‘uintptr_t’
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:269:3: error: unknown type name ‘intptr_t’
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:270:3: error: unknown type name ‘intptr_t’


We used to have a workaround for this, but the patch to import
gnulib's stdint.h removed it:

  http://www.sourceware.org/ml/gdb-patches/2008-06/msg00050.html

and defs.h made to always include stdint.h.  However, gdbserver
doesn't include stdint.h in its equivalent server.h.

Rather than working around the issue, I've imported a more recent
version from glibc, which itself includes <stdint.h>.  Other than
copyright years and FSF snail mail address, the file hasn't been
touched since 2003 in glibc.  AFAICS, our version was updated last in
2000-09-03.

A note on the apparent license change: before the previous patch, this
file's contents were part of gdb_thread_db.h, and we can see that its
license's text was changed in this patch
<http://sourceware.org/ml/gdb-patches/2009-03/msg00251.html>.  That
was certainly just an easy to overlook grep/sed mistake that fell
through the cracks.

gdb/common/
2013-04-16  Pedro Alves  <palves@redhat.com>

	* glibc_thread_db.h: Update from upstream glibc
	(git 568035b7874a099087b77f7bba3e36a1173787b0).
This commit is contained in:
Pedro Alves 2013-04-16 18:17:11 +00:00
parent e115499952
commit f5fb825b47
2 changed files with 51 additions and 25 deletions

View File

@ -1,3 +1,8 @@
2013-04-16 Pedro Alves <palves@redhat.com>
* glibc_thread_db.h: Update from upstream glibc
(git 568035b7874a099087b77f7bba3e36a1173787b0).
2013-04-16 Pedro Alves <palves@redhat.com>
* common/gdb_thread_db.h [!HAVE_THREAD_DB_H]: Factor out to ...

View File

@ -1,26 +1,29 @@
/* Copyright (C) 1999-2013 Free Software Foundation, Inc.
/* thread_db.h -- interface to libthread_db.so library for debugging -lpthread
Copyright (C) 1999-2013 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 3 of the
License, or (at your option) any later version.
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _THREAD_DB_H
#define _THREAD_DB_H 1
/* This is the debugger interface for the LinuxThreads library. It is
modelled closely after the interface with same names in Solaris with
the goal to share the same code in the debugger. */
/* This is the debugger interface for the NPTL library. It is
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/procfs.h>
@ -49,7 +52,10 @@ typedef enum
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_TLSDEFER, /* Thread has not yet allocated TLS for given module. */
TD_NOTALLOC = TD_TLSDEFER,
TD_VERSION, /* Version if libpthread and libthread_db do not match. */
TD_NOTLS /* There is no TLS segment in the given module. */
} td_err_e;
@ -90,6 +96,10 @@ typedef struct td_thrhandle
} td_thrhandle_t;
/* Forward declaration of a type defined by and for the dynamic linker. */
struct link_map;
/* Flags for `td_ta_thr_iter'. */
#define TD_THR_ANY_USER_FLAGS 0xffffffff
#define TD_THR_LOWEST_PRIORITY -20
@ -97,18 +107,17 @@ typedef struct td_thrhandle
#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
{
uint32_t event_bits[TD_EVENTSIZE];
} td_thr_events_t;
/* Event set manipulation macros. */
/* Event set manipulation macros. */
#define __td_eventmask(n) \
(UINT32_C (1) << (((n) - 1) & BT_UIMASK))
#define __td_eventword(n) \
@ -146,7 +155,7 @@ typedef enum
{
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. */
@ -168,8 +177,7 @@ typedef enum
/* 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. */
@ -193,7 +201,7 @@ 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. */
@ -262,15 +270,14 @@ typedef struct td_thrinfo
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; /* Kernel pid for this thread. */
lwpid_t ti_lid; /* Kernel PID for this thread. */
sigset_t ti_sigmask; /* Signal mask. */
unsigned char ti_traceme; /* Nonzero if event reporting
enabled. */
@ -290,6 +297,9 @@ extern td_err_e td_init (void);
/* Historical relict. Should not be used anymore. */
extern td_err_e td_log (void);
/* Return list of symbols the library can request. */
extern const char **td_symbol_list (void);
/* Generate new thread debug library handle for process PS. */
extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta);
@ -342,7 +352,7 @@ extern td_err_e td_ta_clear_event (const td_thragent_t *__ta,
/* Return information about last event. */
extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta,
td_event_msg_t *msg);
td_event_msg_t *__msg);
/* Set suggested concurrency level for process associated with TA. */
@ -394,6 +404,17 @@ extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th,
const void *__addr);
/* Get address of the given module's TLS storage area for the given thread. */
extern td_err_e td_thr_tlsbase (const td_thrhandle_t *__th,
unsigned long int __modid,
psaddr_t *__base);
/* Get address of thread local variable. */
extern td_err_e td_thr_tls_get_addr (const td_thrhandle_t *__th,
psaddr_t __map_address, size_t __offset,
psaddr_t *__address);
/* Enable reporting for EVENT for thread TH. */
extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event);