From owner-svn-ports-all@FreeBSD.ORG Thu Aug 21 18:35:53 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F049747; Thu, 21 Aug 2014 18:35:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5ECA37D5; Thu, 21 Aug 2014 18:35:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7LIZqTJ015906; Thu, 21 Aug 2014 18:35:52 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7LIZqRs015904; Thu, 21 Aug 2014 18:35:52 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201408211835.s7LIZqRs015904@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Thu, 21 Aug 2014 18:35:52 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r365578 - in head/devel/gdb: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2014 18:35:53 -0000 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);