public inbox for gdb-patches@sourceware.org
 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] Make ada_decode not use a static buffer
Date: Sun, 22 Sep 2019 07:49:00 -0000	[thread overview]
Message-ID: <CAPTJ0XH5wsBPmDj7HwM4aiNh6kCSgPRuXa-7vxMSdZ5A5mnrLw@mail.gmail.com> (raw)
In-Reply-To: <87ftkqpwns.fsf@tromey.com>

On Fri, Sep 20, 2019 at 3:58 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> This makes it safer to use in general, and also allows using it on a
> Christian> background thread in the future.
>
> Christian> Inspired by tromey's patch at:
> Christian> https://github.com/tromey/gdb/commit/1226cbdfa436297a5dec054d94592c45891afa93
> Christian> (however, implemented in a different way)
>
> Sorry about the long delay on this.
>
> Christian>  /* If ENCODED follows the GNAT entity encoding conventions, then return
> Christian>     the decoded form of ENCODED.  Otherwise, return "<%s>" where "%s" is
> Christian> -   replaced by ENCODED.
> Christian> +   replaced by ENCODED.  */
>
> Christian> -   The resulting string is valid until the next call of ada_decode.
> Christian> -   If the string is unchanged by decoding, the original string pointer
> Christian> -   is returned.  */
>
> I wonder if the "unchanged" part is a useful optimization.
> If so, then maybe my approach is preferred, though perhaps with
> a new type -- something Pedro pointed out in review.
>
> Something else he mentioned is that he came across a test case where
> this function had a performance impact.  To test this, next week I'll
> try out your patch on a large Ada program we have here to measure the
> impact.  Hopefully it will show nothing, and we can just move forward.

Thank you! For reference, this is Pedro's email where he pointed that out:
https://sourceware.org/ml/gdb-patches/2019-05/msg00673.html

It sounds like one concern was over sniffing the minsym language. It
seems like that shouldn't need allocations at all.

BTW, another option would be to have a thread-local std::string in the
function and reuse that. (or an std::string in a class like Pedro
described)

Christian

  reply	other threads:[~2019-09-22  7:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 20:45 Christian Biesinger via gdb-patches
2019-08-28 21:24 ` [PATCH v2] " Christian Biesinger via gdb-patches
2019-09-11 15:05   ` [PING] " Christian Biesinger via gdb-patches
2019-09-18 22:06     ` Christian Biesinger via gdb-patches
2019-09-20 19:58 ` [PATCH] " Tom Tromey
2019-09-22  7:49   ` Christian Biesinger via gdb-patches [this message]
2019-09-23 17:41 ` Tom Tromey
2019-09-23 18:35   ` [PATCH v3] " 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=CAPTJ0XH5wsBPmDj7HwM4aiNh6kCSgPRuXa-7vxMSdZ5A5mnrLw@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).