From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20678 invoked by alias); 16 Apr 2013 18:31:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20647 invoked by uid 89); 16 Apr 2013 18:31:09 -0000 X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_TX,TW_XF autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 16 Apr 2013 18:31:08 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3GIV6FI025670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Apr 2013 14:31:06 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3GIV5H6009347 for ; Tue, 16 Apr 2013 14:31:05 -0400 Subject: [PATCH 3/6] Update glibc_thread_db.h from upstream. To: gdb-patches@sourceware.org From: Pedro Alves Date: Wed, 17 Apr 2013 01:58:00 -0000 Message-ID: <20130416183104.540.22736.stgit@brno.lan> In-Reply-To: <20130416183043.540.32214.stgit@brno.lan> References: <20130416183043.540.32214.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-SW-Source: 2013-04/txt/msg00502.txt.bz2 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 . 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 . That was certainly just an easy to overlook grep/sed mistake that fell through the cracks. gdb/ 2013-04-16 Pedro Alves * common/glibc_thread_db.h: Update from upstream glibc (git 568035b7874a099087b77f7bba3e36a1173787b0). --- gdb/common/glibc_thread_db.h | 71 +++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/gdb/common/glibc_thread_db.h b/gdb/common/glibc_thread_db.h index 5ddfbc2..97423a4 100644 --- a/gdb/common/glibc_thread_db.h +++ b/gdb/common/glibc_thread_db.h @@ -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 . */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ #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 +#include #include #include @@ -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);