Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
To: Tom Tromey <tom@tromey.com>
Cc: Christian Biesinger via gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v4] Change some arguments to gdb::string_view instead of name+len
Date: Tue, 01 Oct 2019 17:26:00 -0000	[thread overview]
Message-ID: <CAPTJ0XF0=Kc1ZGLtLnfU4PnSkiUYDF47g7KafGm1JPCXt_7YTw@mail.gmail.com> (raw)
In-Reply-To: <87k19o4c5x.fsf@tromey.com>

On Tue, Oct 1, 2019 at 12:18 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> [This version also replaces an instance of strcmp with string_view's
> Christian> operator==, so that the length is correctly respected]
>
> Thanks.
>
> Unfortunately I found / remembered another weirdness.
>
> Christian> -  if (linkage_name[len] != '\0')
> Christian> +  if (linkage_name[linkage_name.length ()] != '\0')
>
> This code let the caller pass in a possibly-unterminated string, and
> then made a local copy with the terminating \0 in that case.
>
> However, this was always a bad idea, and now is probably a libstdc++
> debug-mode assertion failure (<- just guessing but if it isn't, it
> should be!).

Well, gdb::string_view (and libstdc++ in g++ 8 and 10) does have this:
      constexpr const _CharT&
      operator[](size_type __pos) const
      {
// TODO: Assert to restore in a way compatible with the constexpr.
// __glibcxx_assert(__pos < this->_M_len);

So I'm going to change it to .data()[]. Sending a new patch in a second.

Christian


  reply	other threads:[~2019-10-01 17:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-29  5:34 [PATCH] " Christian Biesinger via gdb-patches
2019-09-30 14:28 ` Tom Tromey
2019-09-30 14:38   ` Pedro Alves
2019-09-30 16:23     ` Tom Tromey
2019-09-30 19:33       ` Christian Biesinger via gdb-patches
2019-09-30 19:33         ` [PATCH v2] " Christian Biesinger via gdb-patches
2019-09-30 19:46           ` [PATCH v3] " Christian Biesinger via gdb-patches
2019-09-30 20:02             ` [PATCH v4] " Christian Biesinger via gdb-patches
2019-10-01 17:18               ` Tom Tromey
2019-10-01 17:26                 ` Christian Biesinger via gdb-patches [this message]
2019-10-01 17:26                   ` [PATCH] " Christian Biesinger via gdb-patches
2019-10-01 17:33                   ` Christian Biesinger via gdb-patches
2019-10-01 18:23                     ` Pedro Alves
2019-10-01 18:27                       ` Christian Biesinger via gdb-patches
2019-10-01 18:31                         ` Christian Biesinger via gdb-patches
2019-10-01 19:10                         ` Pedro Alves
2019-10-01 19:30                           ` Christian Biesinger via gdb-patches
2019-10-02 14:45                             ` Pedro Alves
2019-10-02 18:44                               ` Christian Biesinger 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='CAPTJ0XF0=Kc1ZGLtLnfU4PnSkiUYDF47g7KafGm1JPCXt_7YTw@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=cbiesinger@google.com \
    --cc=tom@tromey.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