Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Make addrmap const-correct in cooked index
Date: Mon, 30 Jan 2023 07:15:08 -0700	[thread overview]
Message-ID: <878rhkp0r7.fsf@tromey.com> (raw)
In-Reply-To: <552fb204-0365-5ecc-0e47-086b860325c4@simark.ca> (Simon Marchi's message of "Fri, 27 Jan 2023 16:26:12 -0500")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> 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

  reply	other threads:[~2023-01-30 14:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 16:26 Tom Tromey via Gdb-patches
2023-01-27 19:58 ` Simon Marchi via Gdb-patches
2023-01-27 21:15   ` Tom Tromey via Gdb-patches
2023-01-27 21:18   ` Tom Tromey via Gdb-patches
2023-01-27 21:20     ` Simon Marchi via Gdb-patches
2023-01-27 21:26       ` Simon Marchi via Gdb-patches
2023-01-30 14:15         ` Tom Tromey via Gdb-patches [this message]
2023-01-27 22:00     ` Simon Marchi via Gdb-patches
2023-01-30 14:26       ` Tom Tromey via Gdb-patches
2023-01-30 15:22         ` Simon Marchi via Gdb-patches
2023-01-30 15:29           ` [PATCH v2] " Simon Marchi via Gdb-patches
2023-01-30 16:54             ` Tom Tromey via Gdb-patches
2023-01-30 16:55               ` Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rhkp0r7.fsf@tromey.com \
    --to=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox