From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Fk4GKUu/xWMrVRgAWB0awg (envelope-from ) for ; Mon, 16 Jan 2023 16:19:07 -0500 Received: by simark.ca (Postfix, from userid 112) id 9CB2D1E128; Mon, 16 Jan 2023 16:19:07 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=hDjnmiN3; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 565D21E110 for ; Mon, 16 Jan 2023 16:19:07 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE3553858412 for ; Mon, 16 Jan 2023 21:19:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE3553858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673903946; bh=P06x1eJjJm1mtlCXmNldVP38vaSLQlDdVyC1OCdQOnw=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=hDjnmiN3ouiuh0nNNZ066cP3+dH8JeaLo9lXHK49j3l5tM2zlciYLtpuJUspYE0Sk p7muHFbDwPfpJvnEZ9dWeYz5/1yVUJYKIs/ZU7wt9x2frx4aZ98fGLEgf1FG0MwUPU YYuyJejLrZiQbePpHUZdVPcsMfUyOTjZrDpPGFAE= 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 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) 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> In-Reply-To: <87pmbgq2s0.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" > 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