From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id CE7C43858D32 for ; Mon, 16 Jan 2023 21:18:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE7C43858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 43CB31E110; Mon, 16 Jan 2023 16:18:41 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1673903921; bh=ObzBPsuAIn4M8M8QOFrOzfcNy+zU9ilLgNRHIUa5jOQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=M2FZ2v6Nr8EddztLAPz6TlMcxDIRW0Pqlgpb4JGPt5vWgGNuI+FZJbxkGSpTEvsAr UyHarQR/tQUcvwLquP3Z4MmOSgblsRndMtPfSY2heOzJXRnPtaveapQ1SJxdDJVM4k 3i6C6GLEfau15hrt+goSzEkBa5X8a7knsUKK/7Sk= Message-ID: <4fd385ad-fa48-7fab-0131-d24ae2db45a9@simark.ca> Date: Mon, 16 Jan 2023 16:18:40 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Decl/def matching with templates without template parameters in the DW_AT_name Content-Language: en-US To: Tom Tromey , Simon Marchi via Gdb Cc: David Blaikie References: <525f9315-27f1-935a-4e5e-4a043b24eecf@simark.ca> <87pmbgq2s0.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87pmbgq2s0.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > The main thing I would want to avoid here is trying to put this extra > name-construction into the indexer. That will just slow it down -- but > this is normally the most user-visible slow thing in gdb, and most CUs > are of no interest anyway. > > The downside of this decision is that expansion may expand too many > CUs. So for example if there are a million instantiation of template X > and the user types "break X::method", gdb might expand every CU > referencing X and then still only set one breakpoint. > > However if this is an issue I think the solution could be to be more > selective at expansion time. That is, let the user input "X" match > X, but then actually examine the DIE tree to decide if this match should > result in an expansion. This is my understanding of what you are saying. Save the name without the template part in the cooked index, but attach to it a data structure that describes the template parameters. When the user types, let's say, "b my_class::my_method", "my_class" gets translated to the name "my_class" plus a description of the concrete arguments (the type argument "int" and the value argument 2). Then, when checking if a given CU should expanded, and we have a match for the "my_class" name, we compare the data structures describing the parameters to the one describing the arguments, see if it's really a match. Does that sound right? I'm just a bit worried that it might be difficult to implement this "is there a match function", given the complex rules of C++ template deduction. But maybe it's not so bad, or we already have that logic somewhere. Simon