From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA v2 4/4] Use std::vector in struct catch_syscall_inferior_data
Date: Fri, 21 Jul 2017 20:49:00 -0000 [thread overview]
Message-ID: <1305eee7196c2c59d8e79c72d6c7cd37@polymtl.ca> (raw)
In-Reply-To: <20170719203225.6714-5-tom@tromey.com>
On 2017-07-19 22:32, Tom Tromey wrote:
> @@ -104,31 +106,17 @@ insert_catch_syscall (struct bp_location *bl)
> {
> int elem;
>
> - if (iter >= VEC_length (int, inf_data->syscalls_counts))
> - {
> - int old_size = VEC_length (int,
> inf_data->syscalls_counts);
> - uintptr_t vec_addr_offset
> - = old_size * ((uintptr_t) sizeof (int));
> - uintptr_t vec_addr;
> - VEC_safe_grow (int, inf_data->syscalls_counts, iter +
> 1);
> - vec_addr = ((uintptr_t) VEC_address (int,
> - inf_data->syscalls_counts)
> - + vec_addr_offset);
> - memset ((void *) vec_addr, 0,
> - (iter + 1 - old_size) * sizeof (int));
> - }
> - elem = VEC_index (int, inf_data->syscalls_counts, iter);
> - VEC_replace (int, inf_data->syscalls_counts, iter, ++elem);
> + if (iter >= inf_data->syscalls_counts.size ())
> + inf_data->syscalls_counts.resize (iter + 1);
I wasn't sure at first if this would insert zeros, but after some
searching it seems like the new elements are value-initialized, so it's
fine.
LGTM too.
Simon
prev parent reply other threads:[~2017-07-21 20:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 20:53 [RFA v2 0/4] C++-ify some breakpoint subclasses a bit more Tom Tromey
2017-07-19 20:51 ` [RFA v2 1/4] C++-ify break-catch-sig Tom Tromey
2017-07-20 18:13 ` Sergio Durigan Junior
2017-07-21 19:53 ` Simon Marchi
2017-07-22 3:53 ` Tom Tromey
2017-07-21 19:43 ` Simon Marchi
2017-07-19 20:53 ` [RFA v2 2/4] C++-ify break-catch-throw Tom Tromey
2017-07-20 17:57 ` Sergio Durigan Junior
2017-07-21 20:20 ` Simon Marchi
2017-07-19 20:53 ` [RFA v2 3/4] Use std::vector in syscall_catchpoint Tom Tromey
2017-07-20 17:55 ` Sergio Durigan Junior
2017-07-21 20:37 ` Simon Marchi
2017-07-19 20:54 ` [RFA v2 4/4] Use std::vector in struct catch_syscall_inferior_data Tom Tromey
2017-07-20 16:58 ` Sergio Durigan Junior
2017-07-22 3:43 ` Tom Tromey
2017-07-21 20:49 ` Simon Marchi [this message]
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=1305eee7196c2c59d8e79c72d6c7cd37@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--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