From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id p30NAX/jrmFBOgAAWB0awg (envelope-from ) for ; Mon, 06 Dec 2021 23:30:55 -0500 Received: by simark.ca (Postfix, from userid 112) id E8D061F0CE; Mon, 6 Dec 2021 23:30:54 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 45C511ECEB for ; Mon, 6 Dec 2021 23:30:54 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BBECE3858430 for ; Tue, 7 Dec 2021 04:30:53 +0000 (GMT) Received: from gateway21.websitewelcome.com (gateway21.websitewelcome.com [192.185.45.89]) by sourceware.org (Postfix) with ESMTPS id 39BAE3858C60 for ; Tue, 7 Dec 2021 04:30:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39BAE3858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tromey.com Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway21.websitewelcome.com (Postfix) with ESMTP id B9261400E30ED for ; Mon, 6 Dec 2021 22:30:37 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uS7hmiLzR0ESouS7hmT1QE; Mon, 06 Dec 2021 22:30:37 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4ZL9Yx0BHTobdwftpnKyNIBThvLzJ7CU/JBlSY5XYOU=; b=Lj5pG+KjBJvsM0+NPK6wA32sz3 Zz4PbiPZ5Q4ANvqLhzA8mPRYoBpLe1e9+jbSTwvmePOBi2DZjc+pgnNNKoe3x4ZpWcaJ148hdIJJV dP8BcUuTFOJPk5pq28arwRiOX; Received: from 97-122-84-67.hlrn.qwest.net ([97.122.84.67]:40446 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1muS7h-001pNS-7t; Mon, 06 Dec 2021 21:30:37 -0700 From: Tom Tromey To: Simon Marchi Subject: Re: [PATCH 3/3] Cache the result of find_file_and_directory 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> <3deee783-bee1-887f-6b8f-ffbe74131151@polymtl.ca> X-Attribution: Tom Date: Mon, 06 Dec 2021 21:30:36 -0700 In-Reply-To: <3deee783-bee1-887f-6b8f-ffbe74131151@polymtl.ca> (Simon Marchi's message of "Sun, 5 Dec 2021 20:54:16 -0500") Message-ID: <87r1aprq8j.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.84.67 X-Source-L: No X-Exim-ID: 1muS7h-001pNS-7t X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-84-67.hlrn.qwest.net (localhost.localdomain) [97.122.84.67]:40446 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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: , Cc: Tom Tromey , gdb-patches@sourceware.org, Joel Brobecker Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Simon> Thanks. And while looking at that fix, I had this this question: Simon> looking at find_file_and_directory: Simon> file_and_directory res (dwarf2_string_attr (die, DW_AT_name, cu), Simon> dwarf2_string_attr (die, DW_AT_comp_dir, cu)); Simon> `dwarf2_string_attr (die, DW_AT_name, cu)` is used as the name in Simon> `fnd`, and `fnd` is saved in the dwarf2_per_cu_data structure. Is Simon> `dwarf2_string_attr (die, DW_AT_name, cu)` value guaranteed to live at Simon> least as long as the dwarf2_per_cu_data structure? Yeah. The string data is mapped either from the .debug_str (normally) or .debug_info (for very short strings, sometimes) section. The section data is only unmapped when the per-BFD is destroyed, i.e., when the last reference is removed. (There are other cases here, the section data might be allocated and freed per-objfile if it has relocations, but again, it's long enough.) There are cases where the string data is manipulated first -- C++ name canonicalization (I can't think of another case but maybe there are some). However, when this is done, the resulting string is stored somewhere with the appropriate lifetime, normally the per-BFD obstack. Tom