aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-08-04 09:39:47 +0100
committerPedro Alves <palves@redhat.com>2015-08-04 09:39:47 +0100
commit96e9210fd6fecc1926559dbfa45e7c7c59f7d821 (patch)
tree899fec91cad9fd8554056ebddd0e0b6773af631d /gdb/nat
parentbeab5d94abdbea50febb1e189198fdec43db47c9 (diff)
downloadgdb-96e9210fd6fecc1926559dbfa45e7c7c59f7d821.zip
gdb-96e9210fd6fecc1926559dbfa45e7c7c59f7d821.tar.gz
gdb-96e9210fd6fecc1926559dbfa45e7c7c59f7d821.tar.bz2
C++: dlsym casts in gdb/linux-thread-db.c and gdb/gdbserver/thread-db.c
Implicit void * -> function pointer conversion doesn't work in C++, so in C++, we need to cast the result of dlsym. This adds a few typedefs and macros that make this easy. GDBserver's version already had the CHK macro, so I added it to GDB too. Tested on x86_64 Fedora 20, native and gdbserver. gdb/gdbserver/ChangeLog: 2015-08-04 Pedro Alves <palves@redhat.com> * thread-db.c (struct thread_db): Use new typedefs. (try_thread_db_load_1): Define local TDB_DLSYM macro and use it in CHK calls. (disable_thread_event_reporting): Cast result of dlsym to destination function pointer type. (thread_db_mourn): Use td_ta_delete_ftype. gdb/ChangeLog: 2015-08-04 Pedro Alves <palves@redhat.com> * nat/gdb_thread_db.h (td_init_ftype, td_ta_new_ftype) (td_ta_map_lwp2thr_ftype, td_ta_thr_iter_ftype) (td_ta_event_addr_ftype, td_ta_set_event_ftype) (td_ta_clear_event_ftype, td_ta_event_getmsg_ftype) (td_thr_validate_ftype, td_thr_get_info_ftype) (td_thr_event_enable_ftype, td_thr_tls_get_addr_ftype) (td_thr_tlsbase_ftype, td_symbol_list_ftype, td_ta_delete_ftype): New typedefs. * linux-thread-db.c (struct thread_db_info): Use new typedefs. (try_thread_db_load_1): Define TDB_VERBOSE_DLSYM, TDB_DLSYM , CHK local macros and use them instead of verbose_dlsym and dlsym calls.
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/gdb_thread_db.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/gdb/nat/gdb_thread_db.h b/gdb/nat/gdb_thread_db.h
index a1d9473..2938eaf 100644
--- a/gdb/nat/gdb_thread_db.h
+++ b/gdb/nat/gdb_thread_db.h
@@ -14,3 +14,41 @@
libthread_db associated with whatever libpthread the app is using. */
#define LIBTHREAD_DB_SEARCH_PATH "$sdir:$pdir"
#endif
+
+/* Types of the libthread_db functions. */
+
+typedef td_err_e (td_init_ftype) (void);
+
+typedef td_err_e (td_ta_new_ftype) (struct ps_prochandle * ps,
+ td_thragent_t **ta);
+typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta,
+ lwpid_t lwpid, td_thrhandle_t *th);
+typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta,
+ td_thr_iter_f *callback, void *cbdata_p,
+ td_thr_state_e state, int ti_pri,
+ sigset_t *ti_sigmask_p,
+ unsigned int ti_user_flags);
+typedef td_err_e (td_ta_event_addr_ftype) (const td_thragent_t *ta,
+ td_event_e event, td_notify_t *ptr);
+typedef td_err_e (td_ta_set_event_ftype) (const td_thragent_t *ta,
+ td_thr_events_t *event);
+typedef td_err_e (td_ta_clear_event_ftype) (const td_thragent_t *ta,
+ td_thr_events_t *event);
+typedef td_err_e (td_ta_event_getmsg_ftype) (const td_thragent_t *ta,
+ td_event_msg_t *msg);
+
+typedef td_err_e (td_thr_validate_ftype) (const td_thrhandle_t *th);
+typedef td_err_e (td_thr_get_info_ftype) (const td_thrhandle_t *th,
+ td_thrinfo_t *infop);
+typedef td_err_e (td_thr_event_enable_ftype) (const td_thrhandle_t *th,
+ int event);
+
+typedef td_err_e (td_thr_tls_get_addr_ftype) (const td_thrhandle_t *th,
+ psaddr_t map_address,
+ size_t offset, psaddr_t *address);
+typedef td_err_e (td_thr_tlsbase_ftype) (const td_thrhandle_t *th,
+ unsigned long int modid,
+ psaddr_t *base);
+
+typedef const char ** (td_symbol_list_ftype) (void);
+typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *);