From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yNX5DQXR12OHUiUAWB0awg (envelope-from ) for ; Mon, 30 Jan 2023 09:15:33 -0500 Received: by simark.ca (Postfix, from userid 112) id 367381E128; Mon, 30 Jan 2023 09:15:33 -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=qUCDvREW; 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=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 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 BFD021E110 for ; Mon, 30 Jan 2023 09:15:31 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDD5F3858D38 for ; Mon, 30 Jan 2023 14:15:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDD5F3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675088130; bh=W6bwYPyAmPZr4v3MuMWmRnFYNDmVIQ5bIEQRCFaujbg=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=qUCDvREWsjid+TP6Wp2en7OnzOJ08m0lZMTNYRlv8eacE7zSAY+EKpIS9J3kij/ky J3OShXZr6uLljkobdCHkTFq0sbV1rORgd4Jvp6enVfQ0X3+tN5UNmvUh0sxYi8iFUw pKHzSfGx915ipquBdynCNReKSx68z/f3dj9D+9TI= Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 39D6F3858D1E for ; Mon, 30 Jan 2023 14:15:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39D6F3858D1E Received: by mail-il1-x131.google.com with SMTP id m8so5135194ili.7 for ; Mon, 30 Jan 2023 06:15:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=W6bwYPyAmPZr4v3MuMWmRnFYNDmVIQ5bIEQRCFaujbg=; b=8IP4tmSkCYwiZO2OMGNBq+Pi/U4ayaTt1gagwytipWA0bjQghz9SUt2Z9v60Ovza9N spQS5XYDJSKZ5js3S2+IyQdUBRrHfsOxaS0lEtU+RibHd21rCgHB3xnGETDDMIsg/EzH ZPqTyZS3voze8nYc6645Hd+jN8PCi7UuNuGexr4vVSxIgF7Lm9138VtlOWZ4yGibb2vG 0yWOLQNcXckL/ft2qmA5jJhj6n8W3s9vIYWR/Nuh77fWLTHT5S5+CvUSyEEzeeVBmTqF LY/Im7YjyV2AEAjqBaZXcr+5VlVyCMgUDvqja3sOEPRZwgNVwlR9rHD4me9/yYUzqWUv FYnw== X-Gm-Message-State: AO0yUKUxLlJAuNcMlP4Id5syD28BeB2QcpYcNopclWHCULud4fxldokH psGqFFiXH9Vf5hCRBC8PDTPsyZ4belIYQwPK X-Google-Smtp-Source: AK7set/D67A0f9TSk/JMdvXHlwOI9DBnXuCr2+CioIkn0iPhkL83F2cgD9niI/7qmWSPFtuLxW6dHg== X-Received: by 2002:a05:6e02:1bed:b0:310:b92b:704a with SMTP id y13-20020a056e021bed00b00310b92b704amr7524632ilv.8.1675088110419; Mon, 30 Jan 2023 06:15:10 -0800 (PST) Received: from murgatroyd (75-166-146-144.hlrn.qwest.net. [75.166.146.144]) by smtp.gmail.com with ESMTPSA id c16-20020a92cf10000000b0030da9e6784csm4073686ilo.9.2023.01.30.06.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 06:15:09 -0800 (PST) To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Make addrmap const-correct in cooked index References: <20230127162603.4127820-1-tromey@adacore.com> <8446b53b-bd73-637b-7613-45c896d7240f@simark.ca> <87cz6zptg4.fsf@tromey.com> <993c562b-ff57-771d-f13f-654a85701239@simark.ca> <552fb204-0365-5ecc-0e47-086b860325c4@simark.ca> X-Attribution: Tom Date: Mon, 30 Jan 2023 07:15:08 -0700 In-Reply-To: <552fb204-0365-5ecc-0e47-086b860325c4@simark.ca> (Simon Marchi's message of "Fri, 27 Jan 2023 16:26:12 -0500") Message-ID: <878rhkp0r7.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: Tom Tromey via Gdb-patches Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" >>>>> "Simon" == Simon Marchi writes: >> I suppose in this case we can consider that it's the DWARF code that is >> broken, and that it knows the risks of casting away the const. But at >> least the addrmap code will be correct. Simon> Or, if the client code legitimately wants to modify the contained Simon> objects, then we provide a non-const version of addrmap::find that Simon> returns a non-const pointer. I was thinking about this weekend, and it seems to me that addrmap is just a container and should be able to hold any type -- const or not -- much the way a vector does. The issue on the gdb side is that addrmap isn't templatized and so has to use void* as the type. Anyway from this view, using 'const void *' seems wrong because it moves the type buglet from addrmap to the users of it. Tom