From: Simon Marchi <simon.marchi@ericsson.com>
To: Tom Tromey <tom@tromey.com>, <gdb-patches@sourceware.org>
Subject: Re: [RFA] C++-ify parse_format_string
Date: Thu, 23 Nov 2017 21:14:00 -0000 [thread overview]
Message-ID: <feb17ac9-7732-e2cf-dfe1-ac4e16fb7a61@ericsson.com> (raw)
In-Reply-To: <20171123164631.11055-1-tom@tromey.com>
On 2017-11-23 11:46 AM, Tom Tromey wrote:
> This replaces parse_format_string with a class, removing some
> constructors along the way. While doing this, I found that one
> argument to gen_printf is unused, so I removed it.
>
> Also, I am not completely sure, but the use of `release' in
> maint_agent_printf_command and parse_cmd_to_aexpr seems like it may
> leak expressions.
It looks fishy indeed. You could change argvec to be a vector of
expression_up.
> Regression tested by the buildbot.
I have a patch in some branch that does essentially the same thing, so
I was able to compare our approaches. In my version, I removed the
big allocation that is shared among pieces, and made each piece have
its own std::string. Unless we want to keep the current allocation
scheme for performance/memory usage reasons, I think that using
std::strings simplifies things in the parse_format_string function.
The format_pieces structure is replaced with an std::vector of
format_piece.
I rebased it and stole some parts from your patch for other little cleanups
(e.g. remove unused argument, use vectors of expressions). Here it is,
the 3rd from the top:
https://github.com/simark/binutils-gdb/commits/vec-format_piece
Let me know what you think about the approach, if you think it's good I'll
get it in a mergeable state.
Simon
next prev parent reply other threads:[~2017-11-23 21:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 16:46 Tom Tromey
2017-11-23 21:14 ` Simon Marchi [this message]
2017-11-23 22:40 ` Pedro Alves
2017-11-24 3:17 ` Simon Marchi
2017-11-24 12:54 ` Pedro Alves
2017-11-24 16:26 ` Simon Marchi
2017-11-25 21:25 ` Tom Tromey
2017-12-02 20:31 ` [PATCH] " Simon Marchi
2017-12-03 14:12 ` Pedro Alves
2017-12-03 17:50 ` Simon Marchi
2017-12-08 16:22 ` 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=feb17ac9-7732-e2cf-dfe1-ac4e16fb7a61@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--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