This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] catchpoints bring output in-line with breakpoints output
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Aleksandar Ristovski <aristovski at qnx dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Tue, 27 May 2008 21:57:59 +0300
- Subject: Re: [patch] catchpoints bring output in-line with breakpoints output
- References: <g1hjgi$681$1@ger.gmane.org> <g1hknu$ap3$1@ger.gmane.org>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Aleksandar Ristovski <aristovski@qnx.com>
> Date: Tue, 27 May 2008 14:43:10 -0400
>
> > This patch brings catchpoint output in line with breakpoints output:
Thanks! I have one comment on your changes:
> static enum print_stop_action
> print_exception_catchpoint (struct breakpoint *b)
> {
> + int bp_temp;
> + char msg[160];
> + const char * msgspec;
> + const char msgfmt[] = "\n%s %d (exception %s)\n";
This is not a good idea, because it defeats translation. For
starters, this format string will not be caught by xgettext and won't
be in the message catalog. Moreover, ...
> + sprintf (msg, msgfmt,
> + bp_temp ? "Temporary catchpoint" : "Catchpoint",
> + b->number, msgspec);
... this kind of assembly of a sentence on the flight is bad, because
it doesn't leave the translators an opportunity to see a complete
phrase, and thus the concatenation of 2 fragments translated
independently might well produce a sentence that is invalid in the
target language.
Please instead use the technique you used in another portion of the patch:
> + printf_filtered (bp_temp ? _("Temporary catchpoint %d (throw)")
> + : _("Catchpoint %d (throw)"), b->number);
> else
> - printf_filtered (_("Catchpoint %d (catch)"), b->number);
> + printf_filtered (bp_temp ? _("Temporary catchpoint %d (catch)")
> + : _("Catchpoint %d (catch)"), b->number);
Here, the complete phrases are used, and the small waste of space for
repeating the common part is well worth the gain.