From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 1/2] C++-ify break-catch-sig
Date: Mon, 05 Jun 2017 08:43:00 -0000 [thread overview]
Message-ID: <4bbbfc1a66bb3d2432cdac491a677053@polymtl.ca> (raw)
In-Reply-To: <20170604225353.18008-2-tom@tromey.com>
On 2017-06-05 00:53, Tom Tromey wrote:
> This changes signal_catchpoint to be more of a C++ class, using
> std::vector and updating the users.
>
> gdb/ChangeLog
> 2017-06-04 Tom Tromey <tom@tromey.com>
>
> * break-catch-sig.c (gdb_signal_type): Remove typedef.
> (struct signal_catchpoint) <signals_to_be_caught>: Now a
> std::vector.
> (~signal_catchpoint, signal_catchpoint_insert_location)
> (signal_catchpoint_remove_location)
> (signal_catchpoint_breakpoint_hit, signal_catchpoint_print_one)
> (signal_catchpoint_print_mention)
> (signal_catchpoint_print_recreate)
> (signal_catchpoint_explains_signal): Update.
> (create_signal_catchpoint): Change type of "filter".
> (catch_signal_split_args): Return a std::vector.
> (catch_signal_command): Update.
> ---
Hi Tom,
Thanks for doing this. The patch looks good in general. I'd suggest
doing these in the same patch:
- make the catch_all field/parameter/variable a bool,
- remove the destructor, since it's now empty.
> @@ -99,20 +94,17 @@ static int
> signal_catchpoint_insert_location (struct bp_location *bl)
> {
> struct signal_catchpoint *c = (struct signal_catchpoint *)
> bl->owner;
> - int i;
>
> - if (c->signals_to_be_caught != NULL)
> + if (!c->signals_to_be_caught.empty ())
> {
> - gdb_signal_type iter;
> + gdb_signal iter;
You don't need this declaration...
> - for (i = 0;
> - VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
> - i++)
> + for (auto iter : c->signals_to_be_caught)
...because it's overriden by this one. Although I'd prefer if you used
"gdb_signal" instead of "auto" here. It's not much longer, is more
expressive. There are a few instances of this throughout the patch.
> @@ -246,26 +231,25 @@ signal_catchpoint_print_one (struct breakpoint
> *b,
> uiout->field_skip ("addr");
> annotate_field (5);
>
> - if (c->signals_to_be_caught
> - && VEC_length (gdb_signal_type, c->signals_to_be_caught) > 1)
> + if (!c->signals_to_be_caught.empty ())
I think you changed the behavior of this condition. It should probably
be:
c->signals_to_be_caught.size () > 1
With those comments addressed, the patch is good to me.
Thanks!
Simon
next prev parent reply other threads:[~2017-06-05 8:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-04 22:54 [RFA 0/2] C++-ify some breakpoint subclasses a bit more Tom Tromey
2017-06-04 22:54 ` [RFA 2/2] C++-ify break-catch-throw Tom Tromey
2017-06-05 8:54 ` Simon Marchi
2017-06-05 19:10 ` Tom Tromey
2017-06-05 10:21 ` Pedro Alves
2017-06-05 10:33 ` Pedro Alves
2017-06-05 10:36 ` Pedro Alves
2017-06-05 12:29 ` Pedro Alves
2017-06-05 12:32 ` Pedro Alves
2017-06-05 19:27 ` Tom Tromey
2017-06-06 16:22 ` Pedro Alves
2017-06-07 12:38 ` Tom Tromey
2017-06-07 13:40 ` [pushed] Introduce compiled_regex, eliminate make_regfree_cleanup (Re: [RFA 2/2] C++-ify break-catch-throw) Pedro Alves
2017-06-04 22:54 ` [RFA 1/2] C++-ify break-catch-sig Tom Tromey
2017-06-05 8:43 ` Simon Marchi [this message]
2017-06-05 13:13 ` Tom Tromey
2017-06-05 13:53 ` 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=4bbbfc1a66bb3d2432cdac491a677053@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