From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86213 invoked by alias); 13 Apr 2017 18:56:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 86187 invoked by uid 89); 13 Apr 2017 18:56:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Apr 2017 18:56:13 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 4BC5EAA9DF2EC; Thu, 13 Apr 2017 19:56:07 +0100 (IST) Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 13 Apr 2017 19:56:11 +0100 Received: from [10.20.2.42] (10.20.2.42) by bamail02.ba.imgtec.org (10.20.40.28) with Microsoft SMTP Server id 14.3.266.1; Thu, 13 Apr 2017 11:56:09 -0700 Subject: [PATCH] Fix PR 21337 v2: segfault when re-reading symbols with remote debugging. To: Luis Machado , References: <20511c76-c816-d31d-5144-749eac9fc470@imgtec.com> From: Doug Gilmore Message-ID: <3c5ce0a0-72e5-4460-5555-ad2214866260@imgtec.com> Date: Thu, 13 Apr 2017 18:56:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20511c76-c816-d31d-5144-749eac9fc470@imgtec.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2017-04/txt/msg00450.txt.bz2 I updated and rebased the patch per Luis's comments in: https://www.sourceware.org/ml/gdb-patches/2017-04/msg00361.html which I attached. Could a global maintainer review it when they have the chance? The problem is only exposed on MIPS, however the patch involves changing code that is not MIPS specific. Thanks, Doug gdb/ 2017-??-?? Doug Gilmore * symfile.c (reread_symbols): Fix PR 21337. --- gdb/symfile.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gdb/symfile.c b/gdb/symfile.c index 846aabe..d57563d 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2576,6 +2576,12 @@ reread_symbols (void) /* Free the obstacks for non-reusable objfiles. */ psymbol_bcache_free (objfile->psymbol_cache); objfile->psymbol_cache = psymbol_bcache_init (); + + /* Notify objfiles that we've modified objfile sections, which now + needs to be done early to ensure that, for the MIPS target, + find_pc_section won't access stale data. */ + objfiles_changed (); + obstack_free (&objfile->objfile_obstack, 0); objfile->sections = NULL; objfile->compunit_symtabs = NULL; @@ -2660,9 +2666,6 @@ reread_symbols (void) if (!new_objfiles.empty ()) { - /* Notify objfiles that we've modified objfile sections. */ - objfiles_changed (); - clear_symtab_users (0); /* clear_objfile_data for each objfile was called before freeing it and -- 1.9.1