Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 6/7] Move language stuff out of varobj.c
Date: Thu, 17 Oct 2013 05:40:00 -0000	[thread overview]
Message-ID: <20131017054017.GA3302@adacore.com> (raw)
In-Reply-To: <5257B481.9030003@codesourcery.com>

Sorry for the delay in reviewing this...

> The new patch 4/7 affects this patch.  I post the updated one.  Patch
> 7/7 is not affected, so it can be reviewed too.
> 
> -- 
> Yao (齐尧)
> 
> gdb:
> 
> 2013-10-11  Yao Qi  <yao@codesourcery.com>
> 
> 	* Makefile.in (SFILES): Add c-varobj.c and jv-varobj.c.
> 	(COMMON_OBS): Add c-varobj.o and jv-varobj.o.
> 	* ada-varobj.c: Include "varobj.h".
> 	(ada_number_of_children): New.  Moved from varobj.c.
> 	(ada_name_of_variable, ada_name_of_child): Likewise.
> 	(ada_path_expr_of_child, ada_value_of_child): Likewise.
> 	(ada_type_of_child, ada_value_of_variable): Likewise.
> 	(ada_value_is_changeable_p, ada_value_has_mutated): Likewise.
> 	(ada_varobj_ops): New.
> 	* c-varobj.c, jv-varobj.c: New file.  Moved from varobj.c.
> 	* gdbtypes.c (get_target_type): New.  Moved from varobj.c.
> 	* gdbtypes.h (get_target_type): Declare.
> 	* varobj.c: Remove the inclusion of "ada-varobj.h" and
> 	"ada-lang.h".
> 	(ANONYMOUS_STRUCT_NAME): Move it to c-varobj.c.
> 	(ANONYMOUS_UNION_NAME): Likewise.
> 	(get_type, get_value_type, get_target_type): Remove declarations.
> 	(value_get_print_value, varobj_value_get_print_value): Likewise.
> 	(c_number_of_children, c_name_of_variable): Likewise.
> 	(c_name_of_child, c_path_expr_of_child): Likewise.
> 	(c_value_of_child, c_type_of_child): Likewise.
> 	(c_value_of_variable, cplus_number_of_children): Likewise.
> 	(cplus_class_num_children, cplus_name_of_variable): Likewise.
> 	(cplus_name_of_child, cplus_path_expr_of_child): Likewise.
> 	(cplus_value_of_child, cplus_type_of_child): Likewise.
> 	(cplus_value_of_variable, java_number_of_children): Likewise.
> 	(java_name_of_variable, java_name_of_child): Likewise.
> 	(java_path_expr_of_child, java_value_of_child): Likewise.
> 	(java_type_of_child, java_value_of_variable): Likewise.
> 	(ada_number_of_children, ada_name_of_variable): Likewise.
> 	(ada_name_of_child, ada_path_expr_of_child): Likewise.
> 	(ada_value_of_child, ada_type_of_child): Likewise.
> 	(ada_value_of_variable, ada_value_is_changeable_p): Likewise.
> 	(ada_value_has_mutated): Likewise.
> 	(struct language_specific): Move it to varobj.h.
> 	(CPLUS_FAKE_CHILD): Move it to varobj.h.
> 	(restrict_range): Rename it varobj_restrict_range.  Make it extern.
> 	Callers update.
> 	(get_path_expr_parent): Rename it to varobj_get_path_expr_parent.
> 	Make it extern.
> 	(is_anonymous_child): Move it to c-varobj.c and rename to
> 	varobj_is_anonymous_child.  Caller update.
> 	(get_type): Move it to c-varobj.c.
> 	(get_value_type): Rename it varobj_get_value_type.  Make it
> 	extern.
> 	(get_target_type): Move it gdbtypes.c.
> 	(varobj_formatted_print_options): New function.
> 	(value_get_print_value): Rename it to
> 	varobj_value_get_print_value and make it extern.
> 	(varobj_value_is_changeable_p): Make it extern.
> 	(adjust_value_for_child_access): Move it to c-varobj.c.
> 	(default_value_is_changeable_p): Rename it to
> 	varobj_default_value_is_changeable_p.  Make it extern.
> 	(c_number_of_children, c_name_of_variable): Move it to c-varobj.c
> 	(c_name_of_child, c_path_expr_of_child): Likewise.
> 	(c_value_of_child, c_type_of_child): Likewise.
> 	(c_value_of_variable, cplus_number_of_children): Likewise.
> 	(cplus_class_num_children, cplus_name_of_variable): Likewise.
> 	(cplus_name_of_child, cplus_path_expr_of_child): Likewise.
> 	(cplus_value_of_child, cplus_type_of_child): Likewise.
> 	(cplus_value_of_variable): Likewise.
> 	(java_number_of_children, java_name_of_variable): Move it to jv-varobj.c.
> 	(java_name_of_child, java_path_expr_of_child): Likewise.
> 	(java_value_of_child, java_type_of_child): Likewise.
> 	(java_value_of_variable): Likewise.
> 	(ada_number_of_children, ada_name_of_variable): Move it to ada-varobj.c.
> 	(ada_name_of_child, ada_path_expr_of_child): Likewise.
> 	(ada_value_of_child, ada_type_of_child): Likewise.
> 	(ada_value_of_variable, ada_value_is_changeable_p): Likewise.
> 	(ada_value_has_mutated): Likewise.
> 	* varobj.h (CPLUS_FAKE_CHILD): New macro, moved from varobj.c.
> 	(struct lang_varobj_ops): New.  Renamed by 'struct language_specific'.
> 	(c_varobj_ops, cplus_varobj_ops): Declare.
> 	(java_varobj_ops, ada_varobj_ops): Declare.
> 	(varobj_default_value_is_changeable_p): Declare.
> 	(varobj_value_is_changeable_p): Declare.
> 	(varobj_get_value_type, varobj_is_anonymous_child): Declare.
> 	(varobj_get_path_expr_parent): Declare.
> 	(varobj_value_get_print_value): Declare.
> 	(varobj_formatted_print_options): Declare.
> 	(varobj_restrict_range): Declare.

Overall, this looks pretty good to me. Just a few nits.

> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index 6c809a4..4da6ca2 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -239,6 +239,22 @@ get_type_arch (const struct type *type)
>      return TYPE_OWNER (type).gdbarch;
>  }
>  
> +/* This returns the target type (or NULL) of TYPE, also skipping
> +   past typedefs.  */
> +
> +struct type *
> +get_target_type (struct type *type)

I noticed you documented this function twice, once in the header,
and ones in the body. Can you you only document it once? You have
two options: Remove the documentation in the header entirely, or
replace the documentation in the body by "See gdbtype.h" or some
such. I can't remember exactly the style that TomT introduced for
that - perhaps seem minsyms.h, IIRC.

> -  /* Language info for this variable and its children.  */
> -  struct language_specific *lang;
> +  /* Language-related operations for this variable and its
> +     children.  */
> +  struct lang_varobj_ops *lang;

Please make that field a "const". That way...

> @@ -632,7 +434,7 @@ varobj_create (char *objname,
>  
>        /* Set language info */
>        lang = variable_language (var);
> -      var->root->lang = &languages[lang];
> +      var->root->lang = (struct lang_varobj_ops *) languages[lang];

... we can get rid of the cast here.

Approved with those changes.

Thanks,
-- 
Joel


  reply	other threads:[~2013-10-17  5:40 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-18 13:55 [RFC 0/7] Move language-related " Yao Qi
2013-09-18 13:55 ` [PATCH 5/7] New lang-varobj.h Yao Qi
2013-10-02 17:18   ` Doug Evans
2013-10-08  4:59     ` Joel Brobecker
2013-10-09 23:51       ` Yao Qi
2013-10-09 23:56         ` Doug Evans
2013-10-10  0:19           ` Yao Qi
2013-09-18 13:55 ` [PATCH 6/7] Move language stuff out of varobj.c Yao Qi
2013-10-11  8:20   ` Yao Qi
2013-10-17  5:40     ` Joel Brobecker [this message]
2013-10-17 13:33       ` Yao Qi
2013-09-18 13:55 ` [PATCH 4/7] Move struct varobj to varobj.h Yao Qi
2013-10-02  9:46   ` Joel Brobecker
2013-10-02 19:32     ` Doug Evans
2013-10-06  6:33     ` Yao Qi
2013-10-08  4:56       ` Joel Brobecker
2013-10-08 21:03         ` Doug Evans
2013-10-09  0:28         ` Yao Qi
2013-10-14  8:19         ` Yao Qi
2013-09-18 13:55 ` [PATCH 1/7] Remove field language in struct language_specific Yao Qi
2013-10-01 10:03   ` Joel Brobecker
2013-10-01 13:35     ` Yao Qi
2013-09-18 13:55 ` [PATCH 7/7] Remove ada-varobj.h Yao Qi
2013-10-17  5:46   ` Joel Brobecker
2013-10-17 13:34     ` Yao Qi
2013-09-18 13:55 ` [PATCH 3/7] Remove field value_of_root Yao Qi
2013-10-01 10:16   ` Joel Brobecker
2013-10-01 13:52     ` Yao Qi
2013-09-18 13:55 ` [PATCH 2/7] Remove vlang_unknown Yao Qi
2013-10-01 10:07   ` Joel Brobecker
2013-10-01 13:34     ` Yao Qi
2013-10-02  0:19       ` Doug Evans
2013-10-02  9:32         ` Joel Brobecker
2013-10-04  8:31           ` Yao Qi
2013-09-28  0:56 ` [RFC 0/7] Move language-related stuff out of varobj.c Yao Qi

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=20131017054017.GA3302@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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