Index: gdb/common/glibc_thread_db.h |
diff --git a/gdb/common/gdb_thread_db.h b/gdb/common/glibc_thread_db.h |
similarity index 87% |
copy from gdb/common/gdb_thread_db.h |
copy to gdb/common/glibc_thread_db.h |
index 3f6b6c1adb37b4a8b326e0155f6f1f339ad1a04a..97423a44ffbd43842f027039ea64a90cbcc2b9fd 100644 |
--- a/gdb/common/gdb_thread_db.h |
+++ b/gdb/common/glibc_thread_db.h |
@@ -1,42 +1,29 @@ |
-#ifdef HAVE_THREAD_DB_H |
-#include <thread_db.h> |
- |
-#ifndef LIBTHREAD_DB_SO |
-#define LIBTHREAD_DB_SO "libthread_db.so.1" |
-#endif |
- |
-#ifndef LIBTHREAD_DB_SEARCH_PATH |
-/* $sdir appears before $pdir for some minimal security protection: |
- we trust the system libthread_db.so a bit more than some random |
- libthread_db associated with whatever libpthread the app is using. */ |
-#define LIBTHREAD_DB_SEARCH_PATH "$sdir:$pdir" |
-#endif |
- |
-#else |
- |
-/* Copyright (C) 1999-2000, 2007-2012 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> |
@@ -65,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; |
@@ -106,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 |
@@ -113,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) \ |
@@ -162,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. */ |
@@ -184,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. */ |
@@ -209,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. */ |
@@ -278,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. */ |
@@ -306,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); |
@@ -358,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. */ |
@@ -410,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); |
@@ -451,5 +456,3 @@ 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 */ |