public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: Tom Tromey <tom@tromey.com>,  <gdb-patches@sourceware.org>
Subject: Re: [RFA 3/3] Remove cleanups from break-catch-syscall.c
Date: Wed, 25 Oct 2017 04:42:00 -0000	[thread overview]
Message-ID: <87tvynrg8h.fsf@tromey.com> (raw)
In-Reply-To: <280a7994-38a6-2138-b199-8902ee2651b0@ericsson.com> (Simon	Marchi's message of "Fri, 20 Oct 2017 16:26:15 -0400")

Simon> It is not enough to assign holders.back ().c_str () (after having pushed the string in
Simon> the vector), because when the vector gets reallocated it can now point to stale memory.
Simon> I think we have to do it in two pass, prepare the vector of std::string, and then get
Simon> pointers to the strings.

Sorry about that.  I think I considered this after the earlier review
and believed that the resizing wouldn't affect the locations; my
thinking being that growing the vector must surely use the move
constructor to move the strings into place -- since isn't this pretty
much the whole reason rvalues even exist?  But perhaps this doesn't
happen sometimes for some reason.

Your patch seems reasonable to me.

Tom

  reply	other threads:[~2017-10-25  4:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  4:06 [RFA 1/3] Remove cleanups from prepare_execute_command Tom Tromey
2017-10-18  4:06 ` [RFA 2/3] Remove cleanup from call_function_by_hand_dummy Tom Tromey
2017-10-18  4:06 ` [RFA 3/3] Remove cleanups from break-catch-syscall.c Tom Tromey
2017-10-19 21:00   ` Simon Marchi
2017-10-19 21:57     ` Tom Tromey
2017-10-19 21:57       ` Tom Tromey
2017-10-20 20:26   ` Simon Marchi
2017-10-25  4:42     ` Tom Tromey [this message]
2017-10-25 10:38       ` Pedro Alves
2017-10-25 14:50         ` Tom Tromey
2017-12-06 18:58     ` Sergio Durigan Junior
2017-12-06 21:41       ` 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=87tvynrg8h.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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).