aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/linux-thread-db.c14
-rw-r--r--gdb/nat/gdb_thread_db.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index df49408..ec5a7e4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2018-12-08 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * linux-thread-db.c (struct thread_db_info): Add td_ta_delete_p.
+ (thread_db_err_str): Forward declare.
+ (delete_thread_db_info): Call td_ta_delete_p if available.
+ (try_thread_db_load_1): Acquire td_ta_delete address.
+ * nat/gdb_thread_db.h (td_ta_delete_ftype): Declare.
+
2018-12-08 Pedro Alves <palves@redhat.com>
* source.c (forward_search_command): Rename to ...
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 3c0998e..3027caa 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -194,6 +194,7 @@ struct thread_db_info
td_init_ftype *td_init_p;
td_ta_new_ftype *td_ta_new_p;
+ td_ta_delete_ftype *td_ta_delete_p;
td_ta_map_lwp2thr_ftype *td_ta_map_lwp2thr_p;
td_ta_thr_iter_ftype *td_ta_thr_iter_p;
td_thr_get_info_ftype *td_thr_get_info_p;
@@ -254,6 +255,8 @@ get_thread_db_info (int pid)
return NULL;
}
+static const char *thread_db_err_str (td_err_e err);
+
/* When PID has exited or has been detached, we no longer want to keep
track of it as using libpthread. Call this function to discard
thread_db related info related to PID. Note that this closes
@@ -273,6 +276,16 @@ delete_thread_db_info (int pid)
if (info == NULL)
return;
+ if (info->thread_agent != NULL && info->td_ta_delete_p != NULL)
+ {
+ td_err_e err = info->td_ta_delete_p (info->thread_agent);
+
+ if (err != TD_OK)
+ warning (_("Cannot deregister process %d from libthread_db: %s"),
+ pid, thread_db_err_str (err));
+ info->thread_agent = NULL;
+ }
+
if (info->handle != NULL)
dlclose (info->handle);
@@ -855,6 +868,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
/* These are not essential. */
TDB_DLSYM (info, td_thr_tls_get_addr);
TDB_DLSYM (info, td_thr_tlsbase);
+ TDB_DLSYM (info, td_ta_delete);
/* It's best to avoid td_ta_thr_iter if possible. That walks data
structures in the inferior's address space that may be corrupted,
diff --git a/gdb/nat/gdb_thread_db.h b/gdb/nat/gdb_thread_db.h
index b8259c3..618516e 100644
--- a/gdb/nat/gdb_thread_db.h
+++ b/gdb/nat/gdb_thread_db.h
@@ -41,6 +41,7 @@ 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_delete_ftype) (td_thragent_t *ta_p);
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,