This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] (Ada) New command to stop at start of exception handler.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]