[RFC/RFA] Add support for catch Ada exceptions (take 2)
Joel Brobecker
brobecker@adacore.com
Tue Jan 2 05:44:00 GMT 2007
> > + switch (b->type)
> > + {
> > + case bp_catch_exception:
> > + if (b->addr_string != NULL)
> > + {
> > + const char *template = _("`%s' Ada exception");
> > + char *msg = alloca (strlen (template) + strlen (b->addr_string));
> > +
> > + sprintf (msg, _("`%s' Ada exception"), b->addr_string);
>
> Why don't you use `template' instead of having two identical strings?
That's what I first did, but the compiler complains that he cannot check
the string format. Perhaps I could use a macro instead of the plain
string, that would reduce a bit the chances of mismatch. This case is
very similar to a case discussed recently. Since the strings are very
close, the changes of discrepancy are very slim.
I prefer this solution over using xsnprintf as suggested by Mark,
because we then introduce an arbitrary constant. But it's only a mild
preference, however, so let me know if you prefer it like this:
char msg[512];
xsnprintf (msg, sizeof (msg), _("`%s' Ada exception"), b->addr_string);
--
Joel
More information about the Gdb-patches
mailing list