public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Christian Biesinger <cbiesinger@google.com>
To: Simon Marchi <simon.marchi@efficios.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/4] gdb: add intern method to objfile_per_bfd_storage
Date: Tue, 23 Mar 2021 15:47:39 +0100	[thread overview]
Message-ID: <CAPTJ0XGAGgJ7UWFRcw6F4=ccS30vkXExOKjBnNSqAexJ9Se=GA@mail.gmail.com> (raw)
In-Reply-To: <20210322193417.2376788-2-simon.marchi@efficios.com>

On Mon, Mar 22, 2021 at 8:34 PM Simon Marchi via Gdb-patches
<gdb-patches@sourceware.org> wrote:
>
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> This allows factoring out the internal implementation details that are
> currently in the two objfile::intern methods.
>
> gdb/ChangeLog:
>
>         * objfiles.h (struct objfile_per_bfd_storage) <intern>: New
>         method.
>         (struct objfile) <intern>: Use
>         objfile::objfile_per_bfd_storage::intern.
>
> Change-Id: Ifd54026c5efaeffafac9b84ff84c199acc7ce78a
> ---
>  gdb/objfiles.h | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/objfiles.h b/gdb/objfiles.h
> index 41f8fc913d8..d9aa06636f5 100644
> --- a/gdb/objfiles.h
> +++ b/gdb/objfiles.h
> @@ -270,6 +270,14 @@ struct objfile_per_bfd_storage
>
>    ~objfile_per_bfd_storage ();
>
> +  /* Intern STRING in this object's string cache and return the unique copy.
> +     The copy has the same lifetime as this object.  */
> +
> +  const char *intern (gdb::string_view str)
> +  {
> +    return (const char *) string_cache.insert (str.data (), str.size () + 1);

Is this guaranteed to be nullterminated even without calling c_str()?

Christian

  reply	other threads:[~2021-03-23 14:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 19:34 [PATCH 0/4] Small Misc psymtabs / objfile cleanups Simon Marchi
2021-03-22 19:34 ` [PATCH 1/4] gdb: add intern method to objfile_per_bfd_storage Simon Marchi
2021-03-23 14:47   ` Christian Biesinger [this message]
2021-03-23 15:48     ` Simon Marchi
2021-03-23 15:53       ` Christian Biesinger
2021-03-23 16:08         ` Simon Marchi
2021-04-01 17:44       ` Tom Tromey
2021-04-02 15:38         ` Simon Marchi
2021-03-22 19:34 ` [PATCH 2/4] gdb: use std::string in partial_symtab::partial_symtab / allocate_symtab Simon Marchi
2021-04-01 17:43   ` Tom Tromey
2021-03-22 19:34 ` [PATCH 3/4] gdb: pass objfile_per_bfd_storage instead of objfile to partial_symtab Simon Marchi
2021-04-01 17:47   ` Tom Tromey
2021-04-02 15:42     ` Simon Marchi
2021-03-22 19:34 ` [PATCH 4/4] gdb: remove objfile parameter from get_objfile_bfd_data Simon Marchi
2021-04-01 17:52   ` Tom Tromey
2021-04-02 15:52     ` Simon Marchi

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='CAPTJ0XGAGgJ7UWFRcw6F4=ccS30vkXExOKjBnNSqAexJ9Se=GA@mail.gmail.com' \
    --to=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).