xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/nat/gdb_thread_db.h (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1 /* Copyright (C) 2000-2023 Free Software Foundation, Inc.
2 
3    This file is part of GDB.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef NAT_GDB_THREAD_DB_H
19 #define NAT_GDB_THREAD_DB_H
20 
21 #ifdef HAVE_THREAD_DB_H
22 #include <thread_db.h>
23 #else
24 #include "glibc_thread_db.h"
25 #endif
26 
27 #ifndef LIBTHREAD_DB_SO
28 #define LIBTHREAD_DB_SO "libthread_db.so.1"
29 #endif
30 
31 #ifndef LIBTHREAD_DB_SEARCH_PATH
32 /* $sdir appears before $pdir for some minimal security protection:
33    we trust the system libthread_db.so a bit more than some random
34    libthread_db associated with whatever libpthread the app is using.  */
35 #define LIBTHREAD_DB_SEARCH_PATH "$sdir:$pdir"
36 #endif
37 
38 /* Types of the libthread_db functions.  */
39 
40 typedef td_err_e (td_init_ftype) (void);
41 
42 typedef td_err_e (td_ta_new_ftype) (struct ps_prochandle * ps,
43 				    td_thragent_t **ta);
44 typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *ta_p);
45 typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta,
46 					    lwpid_t lwpid, td_thrhandle_t *th);
47 typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta,
48 					 td_thr_iter_f *callback, void *cbdata_p,
49 					 td_thr_state_e state, int ti_pri,
50 					 sigset_t *ti_sigmask_p,
51 					 unsigned int ti_user_flags);
52 typedef td_err_e (td_ta_event_addr_ftype) (const td_thragent_t *ta,
53 					   td_event_e event, td_notify_t *ptr);
54 typedef td_err_e (td_ta_set_event_ftype) (const td_thragent_t *ta,
55 					  td_thr_events_t *event);
56 typedef td_err_e (td_ta_clear_event_ftype) (const td_thragent_t *ta,
57 					    td_thr_events_t *event);
58 typedef td_err_e (td_ta_event_getmsg_ftype) (const td_thragent_t *ta,
59 					     td_event_msg_t *msg);
60 
61 typedef td_err_e (td_thr_get_info_ftype) (const td_thrhandle_t *th,
62 					  td_thrinfo_t *infop);
63 typedef td_err_e (td_thr_event_enable_ftype) (const td_thrhandle_t *th,
64 					      int event);
65 
66 typedef td_err_e (td_thr_tls_get_addr_ftype) (const td_thrhandle_t *th,
67 					      psaddr_t map_address,
68 					      size_t offset, psaddr_t *address);
69 typedef td_err_e (td_thr_tlsbase_ftype) (const td_thrhandle_t *th,
70 					 unsigned long int modid,
71 					 psaddr_t *base);
72 
73 typedef const char ** (td_symbol_list_ftype) (void);
74 typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *);
75 
76 #endif /* NAT_GDB_THREAD_DB_H */
77