Date: Thu, 21 Aug 2014 18:35:52 +0000 (UTC) From: Tijl Coosemans <tijl@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r365578 - in head/devel/gdb: . files Message-ID: <201408211835.s7LIZqRs015904@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tijl Date: Thu Aug 21 18:35:52 2014 New Revision: 365578 URL: http://svnweb.freebsd.org/changeset/ports/365578 QAT: https://qat.redports.org/buildarchive/r365578/ Log: On FreeBSD 9.x i386 systems, debugging applications with threads causes a crash of gdb. When the libthr is loaded by gdb, the thread support want to add FreeBSD specific information to the current thread. Doing this, it cleans the thread list and re-add the current thread with the updated information (actually, the LWP id). This operation call a free of the struct thread_info (clean/init the thread list) and a malloc of the same struct (add the current thread). The problem is that a pointer to the struct thread_info is stored in another struct (about the execution context) and it's not updatable. On FreeBSD 9.x i386 systems, the malloc return a new pointer; then the execution context contains a broken pointer. On all other platform, the malloc return the same pointer and the execution context stays coherent. This patch avoids to clean the thread list and to re-add the thread; it just update thread information of the current thread. PR: 192890 Submitted by: luca.pizzamiglio@gmail.com (maintainer) Modified: head/devel/gdb/Makefile head/devel/gdb/files/fbsd-threads.c Modified: head/devel/gdb/Makefile ============================================================================== --- head/devel/gdb/Makefile Thu Aug 21 18:32:12 2014 (r365577) +++ head/devel/gdb/Makefile Thu Aug 21 18:35:52 2014 (r365578) @@ -3,7 +3,7 @@ PORTNAME= gdb PORTVERSION= 7.8 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= GNU Modified: head/devel/gdb/files/fbsd-threads.c ============================================================================== --- head/devel/gdb/files/fbsd-threads.c Thu Aug 21 18:32:12 2014 (r365577) +++ head/devel/gdb/files/fbsd-threads.c Thu Aug 21 18:35:52 2014 (r365578) @@ -325,6 +325,11 @@ get_current_thread (void) lwp = get_current_lwp (proc_handle.pid); tmp = BUILD_LWP (lwp, proc_handle.pid); ptid = thread_from_lwp (tmp, &th, &ti); + if (in_thread_list (inferior_ptid) ) + { + struct thread_info * ti_inf = inferior_thread(); + ti_inf->ptid = ptid; + } if (!in_thread_list (ptid)) { attach_thread (ptid, &th, &ti, 1); @@ -439,7 +444,6 @@ static void fbsd_thread_activate (void) { fbsd_thread_active = 1; - init_thread_list(); if (target_has_execution) enable_thread_event_reporting (); fbsd_thread_find_new_threads (NULL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408211835.s7LIZqRs015904>