From: Simon Marchi <simon.marchi@polymtl.ca>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA 4/8] Make strip_bg_char return a unique_xmalloc_ptr
Date: Mon, 16 Oct 2017 18:37:00 -0000 [thread overview]
Message-ID: <88e7166cfba4e631a91a6a34d864d354@polymtl.ca> (raw)
In-Reply-To: <86shejwi6t.fsf@gmail.com>
On 2017-10-16 05:33, Yao Qi wrote:
> Tom Tromey <tom@tromey.com> writes:
>
>> - args = strip_bg_char (args, &async_exec);
>> - args_chain = make_cleanup (xfree, args);
>> + gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (args,
>> &async_exec);
>> + args = stripped.get ();
>>
>> /* Do validation and preparation before possibly changing anything
>> in the inferior. */
>> @@ -663,9 +663,6 @@ run_command_1 (char *args, int from_tty, enum
>> run_how run_how)
>> uiout->flush ();
>> }
>>
>> - /* Done with ARGS. */
>> - do_cleanups (args_chain);
>> -
>
> My concern is that we may leak something if some cleanups are
> registered
> to the cleanup chain in the callees between make_cleanup and
> do_cleanups
> here. However, I am not sure how to detect that.
When reviewing previous cleanup-removal patches, I tried to look for
something that hinted like it would install and return a cleanup, but
it's obviously not a 100% reliable method. What you could do is
temporarily add
struct cleanup *before = cleanup_chain;
at the beginning of the function, and
gdb_assert (cleanup_chain == before);
at the end.
Simon
next prev parent reply other threads:[~2017-10-16 18:37 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 21:00 [RFA 0/8] Constify many commands Tom Tromey
2017-10-13 21:00 ` [RFA 1/8] Constify add_abbrev_prefix_cmd Tom Tromey
2017-10-16 9:02 ` Yao Qi
2017-10-16 15:54 ` Tom Tromey
2017-10-16 20:23 ` Yao Qi
2017-10-13 21:00 ` [RFA 6/8] Remove cleanup from backtrace_command Tom Tromey
2017-10-16 9:46 ` Yao Qi
2017-10-13 21:00 ` [RFA 8/8] Constify add_com Tom Tromey
2017-10-16 9:59 ` Yao Qi
2017-10-13 21:00 ` [RFA 2/8] Constify add_com_suppress_notification Tom Tromey
2017-10-16 9:03 ` Yao Qi
2017-10-16 15:55 ` Tom Tromey
2017-10-13 21:00 ` [RFA 3/8] Make set_cmd_cfunc private Tom Tromey
2017-10-16 9:20 ` Yao Qi
2017-10-13 21:00 ` [RFA 4/8] Make strip_bg_char return a unique_xmalloc_ptr Tom Tromey
2017-10-16 9:33 ` Yao Qi
2017-10-16 18:37 ` Simon Marchi [this message]
2017-10-17 11:05 ` Yao Qi
2017-10-18 3:32 ` Tom Tromey
2017-10-18 9:37 ` Pedro Alves
2017-11-06 16:33 ` Tom Tromey
2017-10-13 21:00 ` [RFA 5/8] Constify add_path and friends Tom Tromey
2017-10-16 9:35 ` Yao Qi
2017-10-13 21:00 ` [RFA 7/8] Add truncate_repeat_arguments function Tom Tromey
2017-10-14 4:49 ` Tom Tromey
2017-10-16 3:07 ` Tom Tromey
2017-10-16 9:53 ` Yao Qi
2017-10-18 3:48 ` Tom Tromey
2017-11-06 16:38 ` Tom Tromey
2017-11-07 14:35 ` Pedro Alves
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=88e7166cfba4e631a91a6a34d864d354@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.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).