This is the mail archive of the gdb-patches@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]

[PATCH] Fix debugging with destroyed TLS


This is a fix for https://sourceware.org/bugzilla/show_bug.cgi?id=19684

I have some code that overwrites FS on x86-64. This breaks debugging
in gdb, because every operation tries to read the thread number,
but fails because TLS is not available.

I just replaced the error with a warning. Seems to work fine as far
as I can tell, all the callers seem to handle a NULL return.

Patch against 7.11, but I expect it will apply to master too.

I don't have commit access.

-Andi

2016-03-18  Andi Kleen  <ak@linux.intel.com>

        * linux-thread-db.c (thread_from_lwp): Only warn when LWP
	cannot be determined.

--- gdb-7.11/gdb/linux-thread-db.c	2016-02-09 19:19:39.000000000 -0800
+++ gdb-7.11-hacked/gdb/linux-thread-db.c	2016-02-24 08:30:49.455778307 -0800
@@ -354,13 +354,19 @@ thread_from_lwp (ptid_t ptid)
   err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid_get_lwp (ptid),
 				   &th);
   if (err != TD_OK)
-    error (_("Cannot find user-level thread for LWP %ld: %s"),
+    {
+      warning (_("Cannot find user-level thread for LWP %ld: %s"),
 	   ptid_get_lwp (ptid), thread_db_err_str (err));
+      return NULL;
+    }
 
   err = info->td_thr_get_info_p (&th, &ti);
   if (err != TD_OK)
-    error (_("thread_get_info_callback: cannot get thread info: %s"),
+    {
+      warning (_("thread_get_info_callback: cannot get thread info: %s"),
 	   thread_db_err_str (err));
+      return NULL;
+    }
 
   /* Fill the cache.  */
   tp = find_thread_ptid (ptid);
-- 
ak@linux.intel.com -- Speaking for myself only


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