This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/Ada 1/2] Add command to list Ada exceptions
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 07 Nov 2013 09:06:56 -0700
- Subject: Re: [RFC/Ada 1/2] Add command to list Ada exceptions
- Authentication-results: sourceware.org; auth=none
- References: <1383836650-6104-1-git-send-email-brobecker at adacore dot com> <1383836650-6104-2-git-send-email-brobecker at adacore dot com>
>>>>> "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