Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFAv2 3/6] Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables]
Date: Sun, 23 Sep 2018 21:34:00 -0000	[thread overview]
Message-ID: <1537738449.2426.1.camel@skynet.be> (raw)
In-Reply-To: <874lemu7kz.fsf@tromey.com>

Feedback below ...

RFAv3 will follow soon

Thanks for the comments.

Philippe


On Tue, 2018-09-18 at 09:51 -0600, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe>   As stack.h now uses a type defined in gdb_regex.h, all files including stack.h
> Philippe>   need to include gdb_regex.h.
> 
> It's better to just include gdb_regex.h from stack.h in this situation.
Done (rather, no need anymore for regexp in stack.h).

> 
> Philippe> +	  if (preg
> 
> I think preg.has_value ().  gdb is trending away from these bool
> conversions, I think.  At least that's been the style for pointers.
> 
> Philippe> +	  if (treg
> 
> Here too.
Done.

> 
> Philippe> +/* Prepares the regular expression REG from REGEXP.
> Philippe> +   If REGEXP is NULL, it results in an empty regular expression.  */
> Philippe> +static void
> Philippe> +prepare_reg (const char *regexp, gdb::optional<compiled_regex> &reg)
> 
> Out parameters should be pointers in the gdb style.
Done.


> 
> Philippe> -  iterate_over_block_local_vars (block,
> Philippe> +  iterate_over_block_local_vars (block, preg, treg,
> Philippe>  				 do_print_variable_and_value,
> Philippe>  				 &cb_data);
> 
> iterate_over_block_local_vars already takes some opaque data that it
> just passes through to the callback.  So, I think there should not be
> a need to add the regexp parameters directly to it.  Instead they can be
> put into the cb_data here.
> 
> Philippe>  void
> Philippe>  iterate_over_block_arg_vars (const struct block *b,
> Philippe> +			     const gdb::optional<compiled_regex> &preg,
> Philippe> +			     const gdb::optional<compiled_regex> &treg,
> Philippe>  			     iterate_over_block_arg_local_vars_cb cb,
> Philippe>  			     void *cb_data)
> 
> Same here.

Done: the preg/treg regexp have been put in the opaque cb_data,
and regexp filtering logic has been moved to do_print_variable_and_value.


> 
> Philippe> +/* Returns true if the type_name of symbol_type of SYM matches TREG.
> Philippe> +   If SYM has no symbol_type or symbol_name, returns false.  */
> Philippe> +
> Philippe> +bool
> Philippe> +treg_matches_sym_type_name (const compiled_regex &treg,
> Philippe> +			    const struct symbol *sym)
> Philippe> +{
> Philippe> +  if (language_mode == language_mode_auto)
> Philippe> +    language_def (SYMBOL_LANGUAGE (sym))->la_print_type
> Philippe> +      (sym_type, "", &printed_sym_type_name,
> Philippe> +       -1, 0, &default_ptype_flags);
> 
> I think this won't actually work, because the type printing code is free
> to use current_language.  This is not good, but it is how it is.
> 
> So instead I think what this should do is save and restore the current
> language.  IIRC there's a helper RAII class for that already.
> 
> Then you can just call type_print and drop patch #2.
Done.

> 
> Philippe> +extern bool
> Philippe> +treg_matches_sym_type_name (const compiled_regex &treg,
> Philippe> +			    const struct symbol *sym);
>  
> No newline after the "bool" for a declaration.
Done.

Thanks
Philippe


  reply	other threads:[~2018-09-23 21:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-26 16:54 [RFAv2 0/6] info [args|functions|locals|variables] [-q] [-t TYPEREGEXP] [NAMEREGEXP] Philippe Waroquiers
2018-08-26 16:54 ` [RFAv2 1/6] New cli-utils.h/.c function extract_info_print_args Philippe Waroquiers
2018-09-18 15:31   ` Tom Tromey
2018-09-23 20:16     ` Philippe Waroquiers
2018-09-24 13:07       ` Tom Tromey
2018-09-25  4:37         ` Philippe Waroquiers
2018-08-26 16:54 ` [RFAv2 2/6] Make struct type_print_options default_ptype_flags non static Philippe Waroquiers
2018-08-26 16:54 ` [RFAv2 6/6] Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP] Philippe Waroquiers
2018-08-26 16:54 ` [RFAv2 4/6] Document changes to info [args|functions|locals|variables] Philippe Waroquiers
2018-08-26 18:19   ` Eli Zaretskii
2018-08-26 16:54 ` [RFAv2 5/6] Announce changes in NEWS " Philippe Waroquiers
2018-08-26 18:21   ` Eli Zaretskii
2018-08-27  4:39     ` Philippe Waroquiers
2018-08-27 14:59       ` Eli Zaretskii
2018-08-26 16:54 ` [RFAv2 3/6] Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args " Philippe Waroquiers
2018-09-18 15:52   ` Tom Tromey
2018-09-23 21:34     ` Philippe Waroquiers [this message]
2018-09-06 20:16 ` PING Re: [RFAv2 0/6] info [args|functions|locals|variables] [-q] [-t TYPEREGEXP] [NAMEREGEXP] Philippe Waroquiers
2018-09-13 19:27 ` PING^2 " Philippe Waroquiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537738449.2426.1.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox