This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] (Ada) New command to stop at start of exception handler.
- From: Pedro Alves <palves at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>, Xavier Roirand <roirand at adacore dot com>, Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 14 Dec 2017 15:09:11 +0000
- Subject: Re: [RFA] (Ada) New command to stop at start of exception handler.
- Authentication-results: sourceware.org; auth=none
- References: <1513094242-2313-1-git-send-email-roirand@adacore.com> <20171214142957.ntnoteiheetx4qb2@adacore.com>
On 12/14/2017 02:29 PM, Joel Brobecker wrote:
>> > + char *info = xstrprintf (_("`%s' Ada exception hanlder"), c->excep_string);
> This line is too long.
>
>> > + struct cleanup *old_chain = make_cleanup (xfree, info);
> Let's be consistent with the above, and just do an xfree directly
> right after the call to uiout->field_string.
>
You can do:
std::string info = string_printf (_("`%s' Ada exception hanlder"),
c->excep_string);
....
uiout->text (info.c_str ());
and then you no longer have to worry about explicitly
calling xfree, or, leaking if uiout->text() throws
(which it can, if it paginates and the user aborts, for
example).
But there's also uiout->field_fmt(), which may be
better here if the field is supposed to be an MI attribute:
uiout->field_fmt ("somename",
_("`%s' Ada exception hanlder"),
c->excep_string);
Also, typo "hanlder" in format string. :-)
I haven't really read the description of the command / use case,
but this sounds very much like the existing "catch catch"?
Thanks,
Pedro Alves