This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] linux-thread-db.c (record_thread): Return the created thread.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=be550b6ed9d6c5948d2c331a396020769f65204f

commit be550b6ed9d6c5948d2c331a396020769f65204f
Author: Doug Evans <xdje42@gmail.com>
Date:   Fri Sep 18 23:21:04 2015 -0700

    linux-thread-db.c (record_thread): Return the created thread.
    
    gdb/ChangeLog:
    
    	* linux-thread-db.c (record_thread): Return the created thread.
    	(thread_from_lwp): Likewise.
    	(thread_db_get_thread_local_address): Update.

Diff:
---
 gdb/ChangeLog         |  6 ++++++
 gdb/linux-thread-db.c | 26 ++++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 027a10f..4f4f048 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2015-09-18  Doug Evans  <xdje42@gmail.com>
 
+	* linux-thread-db.c (record_thread): Return the created thread.
+	(thread_from_lwp): Likewise.
+	(thread_db_get_thread_local_address): Update.
+
+2015-09-18  Doug Evans  <xdje42@gmail.com>
+
 	* symtab.h (general_symbol_info) <mangled_lang>: Delete struct,
 	move only member demangled_name up.  All uses updated.
 
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 855629b..b5719eb 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -198,10 +198,9 @@ static void thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new);
 
 static void check_thread_signals (void);
 
-static void record_thread (struct thread_db_info *info,
-			   struct thread_info *tp,
-			   ptid_t ptid, const td_thrhandle_t *th_p,
-			   const td_thrinfo_t *ti_p);
+static struct thread_info *record_thread
+  (struct thread_db_info *info, struct thread_info *tp,
+   ptid_t ptid, const td_thrhandle_t *th_p, const td_thrinfo_t *ti_p);
 
 /* Add the current inferior to the list of processes using libpthread.
    Return a pointer to the newly allocated object that was added to
@@ -386,7 +385,7 @@ have_threads (ptid_t ptid)
 
 /* Fetch the user-level thread id of PTID.  */
 
-static void
+static struct thread_info *
 thread_from_lwp (ptid_t ptid)
 {
   td_thrhandle_t th;
@@ -419,7 +418,7 @@ thread_from_lwp (ptid_t ptid)
 
   /* Fill the cache.  */
   tp = find_thread_ptid (ptid);
-  record_thread (info, tp, ptid, &th, &ti);
+  return record_thread (info, tp, ptid, &th, &ti);
 }
 
 
@@ -1287,10 +1286,10 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
 }
 
 /* Record a new thread in GDB's thread list.  Creates the thread's
-   private info.  If TP is NULL, creates a new thread.  Otherwise,
-   uses TP.  */
+   private info.  If TP is NULL or TP is marked as having exited,
+   creates a new thread.  Otherwise, uses TP.  */
 
-static void
+static struct thread_info *
 record_thread (struct thread_db_info *info,
 	       struct thread_info *tp,
 	       ptid_t ptid, const td_thrhandle_t *th_p,
@@ -1304,7 +1303,7 @@ record_thread (struct thread_db_info *info,
      initialized yet.  Leave private == NULL until the thread library
      has initialized.  */
   if (ti_p->ti_tid == 0)
-    return;
+    return tp;
 
   /* Construct the thread's private data.  */
   priv = XCNEW (struct private_thread_info);
@@ -1333,6 +1332,8 @@ record_thread (struct thread_db_info *info,
 
   if (target_has_execution)
     check_thread_signals ();
+
+  return tp;
 }
 
 static void
@@ -1854,10 +1855,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 
   /* We may not have discovered the thread yet.  */
   if (thread_info != NULL && thread_info->priv == NULL)
-    {
-      thread_from_lwp (ptid);
-      thread_info = find_thread_ptid (ptid);
-    }
+    thread_info = thread_from_lwp (ptid);
 
   if (thread_info != NULL && thread_info->priv != NULL)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]