This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix debugging with destroyed TLS
- From: Andi Kleen <ak at linux dot intel dot com>
- To: gdb-patches at gcc dot gnu dot org
- Date: Fri, 18 Mar 2016 14:15:24 -0700
- Subject: [PATCH] Fix debugging with destroyed TLS
- Authentication-results: sourceware.org; auth=none
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