From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id HrDwAmRtrWHgBgAAWB0awg (envelope-from ) for ; Sun, 05 Dec 2021 20:54:44 -0500 Received: by simark.ca (Postfix, from userid 112) id EFF861F0CE; Sun, 5 Dec 2021 20:54:43 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6F4A81E940 for ; Sun, 5 Dec 2021 20:54:43 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D35A73858422 for ; Mon, 6 Dec 2021 01:54:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D35A73858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638755682; bh=J8JbuRIyDUu3pZaLHbULz3CYZTbuWMhtgrWbNZEn1mQ=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=BYAdTrejNC/9awP3s80xofVC6goMcCbuGufQO1gYZ8+VlnqVRA9Bv6aDx7jSV3Xwn erDSzkeaYEaalzBtG9nEOTzUEW0D96sGh/yBfHSK72STD5KWSLH/+sg3sRH93LzMWJ MdQXM1C40YB6JFE5C6Jqnx8TLeSnzZ3K5ka/dqXM= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 541633858D28 for ; Mon, 6 Dec 2021 01:54:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 541633858D28 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 1B61sH4m020977 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 5 Dec 2021 20:54:22 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1B61sH4m020977 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 516DC1E940; Sun, 5 Dec 2021 20:54:17 -0500 (EST) Message-ID: <3deee783-bee1-887f-6b8f-ffbe74131151@polymtl.ca> Date: Sun, 5 Dec 2021 20:54:16 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 3/3] Cache the result of find_file_and_directory Content-Language: en-US To: Tom Tromey References: <20211130013304.4135367-1-tom@tromey.com> <20211130013304.4135367-4-tom@tromey.com> <87tufotela.fsf@tromey.com> <104bfab9-d713-1ec8-3a44-09a8403e2c3f@polymtl.ca> <87k0gju31v.fsf@tromey.com> <874k7mu7q5.fsf@tromey.com> In-Reply-To: <874k7mu7q5.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 6 Dec 2021 01:54:17 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: gdb-patches@sourceware.org, Joel Brobecker Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-12-05 15:17, Tom Tromey wrote: >>> Sorry about that. I'll fix it soon. Or you can back it out if you >>> prefer. > > Simon> I'm not personally affected so I do not mind, I can wait for the fix. > > Here is what I am checking in. > I was able to reproduce the failure with valgrind, and confirmed that > this patch fixes it. > > Tom Thanks. And while looking at that fix, I had this this question: looking at find_file_and_directory: static file_and_directory & find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu) { if (cu->per_cu->fnd != nullptr) return *cu->per_cu->fnd; /* Find the filename. Do not use dwarf2_name here, since the filename is not a source language identifier. */ file_and_directory res (dwarf2_string_attr (die, DW_AT_name, cu), dwarf2_string_attr (die, DW_AT_comp_dir, cu)); if (res.get_comp_dir () == nullptr && producer_is_gcc_lt_4_3 (cu) && res.get_name () != nullptr && IS_ABSOLUTE_PATH (res.get_name ())) res.set_comp_dir (ldirname (res.get_name ())); cu->per_cu->fnd.reset (new file_and_directory (std::move (res))); return *cu->per_cu->fnd; } `dwarf2_string_attr (die, DW_AT_name, cu)` is used as the name in `fnd`, and `fnd` is saved in the dwarf2_per_cu_data structure. Is `dwarf2_string_attr (die, DW_AT_name, cu)` value guaranteed to live at least as long as the dwarf2_per_cu_data structure? IIUC, the die_info objects are tied to a dwarf2_cu. And dwarf2_cus can be deleted (by free_cached_comp_units). I might be wrong, but I thought I'd raise the point just in case. Simon