From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113297 invoked by alias); 29 Apr 2017 17:12:42 -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 113245 invoked by uid 89); 29 Apr 2017 17:12:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1502, happening 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; Sat, 29 Apr 2017 17:12:40 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 960C1D41CAC8; Sat, 29 Apr 2017 18:12:35 +0100 (IST) Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.294.0; Sat, 29 Apr 2017 18:12:39 +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; Sat, 29 Apr 2017 10:12:37 -0700 Subject: Re: [PATCH] Fix PR 21337 v2: segfault when re-reading symbols with remote debugging. To: Simon Marchi References: <20511c76-c816-d31d-5144-749eac9fc470@imgtec.com> <3c5ce0a0-72e5-4460-5555-ad2214866260@imgtec.com> <5c494cc147f71dd8246572aa0b815c9f@polymtl.ca> <7e9595026acbfd2f1a7bff321fa255e1@polymtl.ca> <5b5cc0a61e434a3406cbb25c16b8a550@polymtl.ca> CC: Luis Machado , From: Doug Gilmore Message-ID: Date: Sat, 29 Apr 2017 17:12: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: <5b5cc0a61e434a3406cbb25c16b8a550@polymtl.ca> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-SW-Source: 2017-04/txt/msg00818.txt.bz2 On 04/28/17 18:41, Simon Marchi wrote: > On 2017-04-28 19:44, Doug Gilmore wrote: >> Hi Simon, >> >> After thinking about it my comment and code placement wasn't >> particularly good. Something along the line's of Luis's change >> is better. >> >> Does Luis's comment address the question you have? >> >> If so, Luis: Should is it OK we incorporate your changes in the patch? >> >> I attached a diff for the change. >> >> Thanks, >> >> Doug > > Hi Doug, > > The comment certainly helps, but in the commit log I'd like to see a > more detailed list of events that leads to the crash. > > Now that I look into it again, I think I understand. The > objfile_pspace_info::sections array/vector is a list of obj_section > pointers (in C++ we'd probably use an std::vector). > That list contains pointers to all the sections from all the > objfiles sorted in order of increasing address. They point directly > to the sections allocated by the objfile in their obstacks (and > accessible through objfile::sections). So when the obstack is freed > in reread_symbols, the sorted list contains stale pointers. Is that > it? Right. > > If that's what's happening, then I'm more convinced the fix is > right. Is this behaviour caught by a test? If not, could you write > one? > ... I'll need to take a look. Last time I tried I it was more difficult to expose the problem on the native build of GDB. Thanks, Doug