From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC/Ada 1/2] Add command to list Ada exceptions
Date: Thu, 07 Nov 2013 16:11:00 -0000 [thread overview]
Message-ID: <87bo1wxkkf.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1383836650-6104-2-git-send-email-brobecker@adacore.com> (Joel Brobecker's message of "Thu, 7 Nov 2013 19:04:09 +0400")
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> (gdb) info exceptions
Joel> All defined exceptions:
Joel> constraint_error: 0x613dc0
Since the name of the command is unavoidably generic, how about adding
"Ada" into the output somewhere, so that non-Ada users don't get
confused when the command doesn't do anything useful for them?
Like
(gdb) info exceptions
All defined Ada exceptions:
constraint_error: 0x613dc0
Joel> + for (i = 0; i < sizeof (standard_exc) / sizeof (char *); i++)
How about ARRAY_SIZE here?
Joel> +static void
Joel> +ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame,
Joel> + VEC(ada_exc_info) **exceptions)
Joel> +{
[...]
Joel> + if (BLOCK_FUNCTION (block))
The current style requires a "!= NULL" here.
Joel> +VEC(ada_exc_info) *
Joel> +ada_exceptions_list (char *regexp)
I think regexp can be const.
Joel> + if (regexp != NULL)
Joel> + {
Joel> + int status;
Joel> +
Joel> + preg = alloca (sizeof (regex_t));
Joel> + status = regcomp (preg, regexp, REG_NOSUB);
Joel> + if (status != 0)
Joel> + {
Joel> + char *err = get_regcomp_error (status, preg);
Joel> +
Joel> + make_cleanup (xfree, err);
Joel> + error (_("Invalid regexp (%s): %s"), err, regexp);
Joel> + }
Joel> + make_regfree_cleanup (preg);
Joel> + }
These days there is compile_rx_or_error, which wraps all this up.
Joel> + printf_filtered (regexp
Joel> + ? "All exceptions matching regular expression \"%s\":\n"
Joel> + : "All defined exceptions:\n", regexp);
This needs an explicit "== NULL".
Tom
next prev parent reply other threads:[~2013-11-07 16:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 15:04 RFC new CLI + GDB/MI commands " Joel Brobecker
2013-11-07 15:05 ` [RFC/Ada 1/2] Add command " Joel Brobecker
2013-11-07 16:11 ` Eli Zaretskii
2013-11-07 16:34 ` Tom Tromey
2013-11-07 16:11 ` Tom Tromey [this message]
2013-11-07 15:10 ` [RFC/Ada 2/2] Implement GDB/MI equivalent of "info exceptions" CLI command Joel Brobecker
2013-11-07 16:12 ` Eli Zaretskii
2013-11-07 16:28 ` 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=87bo1wxkkf.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/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