From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@efficios.com>,
Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [PATCH 2/3] gdb: make interp::m_name an `const char *`
Date: Tue, 07 Mar 2023 12:29:24 -0700 [thread overview]
Message-ID: <87zg8oqs17.fsf@tromey.com> (raw)
In-Reply-To: <20230302203224.118345-3-simon.marchi@efficios.com> (Simon Marchi via Gdb-patches's message of "Thu, 2 Mar 2023 15:32:23 -0500")
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> I realized that the memory for interp names does not need to be
Simon> allocated. The name used to register interp factory functions is always
Simon> a literal string, so has static storage duration. If we change
Simon> interp_lookup to pass that name instead of the string that it receives
Simon> as a parameter (which does not always have static storage duration),
Simon> then interps can simply store pointers to the name.
I wish we had a way to detect/enforce this. That way lies rust I suppose.
Simon> So, change interp_lookup to pass `factory.name` rather than `name`.
Simon> Change interp::m_name to be a `const char *` rather than an std::string.
Reviewed-By: Tom Tromey <tom@tromey.com>
Tom
next prev parent reply other threads:[~2023-03-07 19:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 20:32 [PATCH 0/3] Some minor interps tweaks Simon Marchi via Gdb-patches
2023-03-02 20:32 ` [PATCH 1/3] gdb: make get_interp_info return a reference Simon Marchi via Gdb-patches
2023-03-07 19:27 ` Tom Tromey
2023-03-07 20:34 ` Simon Marchi via Gdb-patches
2023-03-07 20:45 ` Tom Tromey
2023-03-07 20:52 ` Simon Marchi via Gdb-patches
2023-03-07 21:29 ` Tom Tromey
2023-03-07 21:31 ` Simon Marchi via Gdb-patches
2023-03-02 20:32 ` [PATCH 2/3] gdb: make interp::m_name an `const char *` Simon Marchi via Gdb-patches
2023-03-07 19:29 ` Tom Tromey [this message]
2023-03-02 20:32 ` [PATCH 3/3] gdb: initialize interp::next Simon Marchi via Gdb-patches
2023-03-07 19:29 ` Tom Tromey
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=87zg8oqs17.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--cc=simon.marchi@polymtl.ca \
/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