From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA 2/2] C++-ify break-catch-throw
Date: Mon, 05 Jun 2017 19:27:00 -0000 [thread overview]
Message-ID: <871sqy6xqq.fsf@pokyo> (raw)
In-Reply-To: <fe85cf79-1db6-bffe-2419-63c8decb901d@redhat.com> (Pedro Alves's message of "Mon, 5 Jun 2017 13:29:36 +0100")
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> So something like this. Builds and gdb starts, but I have
Pedro> not regtested it.
Thanks for doing this. I should have noticed the compile_rx_or_error
problem in my patch -- IIRC I wrote compile_rx_or_error and even
violated my own rule about cleanup naming (that cleanup-returning
functions should start "make_cleanup_") at the time. Double ouch.
Pedro> In a couple places, this either forces moving the regex object
Pedro> to the heap, or to wrap it in gdb::optional. In the cases
Pedro> where we already have to keep the regex string around,
Pedro> it ends up being not maximally efficient memory-wise, but I don't
Pedro> think it really matters. We're considering std::string for
Pedro> those same strings, which grows the structs more than that, anyway
Pedro> (for size/capacity).
I was thinking that perhaps the regexp object should just have its own
optionality. But, I think your way is also fine, maybe more principled
in a way.
I didn't look at all the cases, but at least for "catch throw" it
doesn't seem to matter much. For a few bytes in that structure to be a
problem, someone would have to use thousands or millions of catchpoints,
which seems absurd.
Pedro> WDYT?
Looks great, I will wait for this to land before round 2.
Pedro> +ada_add_standard_exceptions (gdb_regex *preg, VEC(ada_exc_info) **exceptions)
The various callees could use const if the exec method was const.
Pedro> + /* Compile a regexp and throw an exception on error, including
Pedro> + MESSAGE. REGEX and MESSAGE must not be NULL. */
Pedro> + gdb_regex (const char *regex, int cflags,
Pedro> + const char *message);
Use ATTRIBUTE_NONNULL?
Pedro> + /* Wrapper around ::regexec. */
Pedro> + int exec (const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
Pedro> +
Pedro> + /* Wrapper around ::re_search. */
Pedro> + int search (const char *string, int size,
Pedro> + int startpos, int range, struct re_registers *regs);
Could both be 'const', I think.
Tom
next prev parent reply other threads:[~2017-06-05 19:27 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 1/2] C++-ify break-catch-sig Tom Tromey
2017-06-05 8:43 ` Simon Marchi
2017-06-05 13:13 ` Tom Tromey
2017-06-05 13:53 ` 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 [this message]
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
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=871sqy6xqq.fsf@pokyo \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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