[RFAv2 1/3] New "info sources" args [-dirname | -basename] [--] [REGEXP]

Tom Tromey tom@tromey.com
Wed Jul 24 19:14:00 GMT 2019


>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> gdb/ChangeLog
Philippe> 2019-06-16  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

This commit probably needs a bit of intro text.

Philippe> +static void
Philippe> +print_info_sources_header (const char *symbol_msg,
Philippe> +			   const struct output_source_filename_data *data)
Philippe> +{
Philippe> +  printf_filtered ("Source files ");
Philippe> +  if (!data->regexp.empty ())
Philippe> +    {
Philippe> +      if (data->partial_match.dirname)
Philippe> +	printf_filtered ("(dirname ");
Philippe> +      else if (data->partial_match.basename)
Philippe> +	printf_filtered ("(basename ");
Philippe> +      else
Philippe> +	printf_filtered ("(filename ");
Philippe> +      printf_filtered ("matching regular expression \"%s\") ",
Philippe> +		       data->regexp.c_str ());
Philippe> +    }
Philippe> +  printf_filtered ("for which symbols %s:\n\n", symbol_msg);

This sort of approach isn't very i18n-friendly.  I think we've been
trying to avoid introducing new code like this, in hopes that maybe
somebody will provide gdb translations some day.

One idea might be to separate the main text from the parenthetical text,
so like:

  printf_filtered (_("Source files for which symbols have been read in"));
  if (blah)
    printf_filtered (_("(dirname matching regular expression \"%s\")"), dirname);
  ...
  printf_filtered (_(":\n"));

The "if"s could be factored into a helper function.

Otherwise this patch seems good to me.  Thanks for doing this.

Tom



More information about the Gdb-patches mailing list