[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5050A6FA.1080503@hitachi.com>
Date: Thu, 13 Sep 2012 00:15:06 +0900
From: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To: Hyeoncheol Lee <hyc.lee@...il.com>
Cc: acme@...stprotocols.net, linux-kernel@...r.kernel.org,
yrl.pp-manager.tt@...achi.com
Subject: Re: [PATCH -tip/perf/core] perf probe: Add union member access
support
(2012/09/12 16:57), Hyeoncheol Lee wrote:
> Union members can be accessed with '.' or '->' like data structure
> member access
This seems good to me :)
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Thank you!
>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
> Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
> Signed-off-by: Hyunchul Lee <hyc.lee@...il.com>
> ---
> tools/perf/util/probe-finder.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 94a00de..cc2b856 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -525,8 +525,10 @@ static int convert_variable_fields(Dwarf_Die
> *vr_die, const char *varname,
> return -ENOENT;
> }
> /* Verify it is a data structure */
> - if (dwarf_tag(&type) != DW_TAG_structure_type) {
> - pr_warning("%s is not a data structure.\n", varname);
> + tag = dwarf_tag(&type);
> + if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
> + pr_warning("%s is not a data structure nor an union.\n",
> + varname);
> return -EINVAL;
> }
>
> @@ -539,8 +541,9 @@ static int convert_variable_fields(Dwarf_Die
> *vr_die, const char *varname,
> *ref_ptr = ref;
> } else {
> /* Verify it is a data structure */
> - if (tag != DW_TAG_structure_type) {
> - pr_warning("%s is not a data structure.\n", varname);
> + if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
> + pr_warning("%s is not a data structure nor an union.\n",
> + varname);
> return -EINVAL;
> }
> if (field->name[0] == '[') {
> @@ -567,10 +570,15 @@ static int convert_variable_fields(Dwarf_Die
> *vr_die, const char *varname,
> }
>
> /* Get the offset of the field */
> - ret = die_get_data_member_location(die_mem, &offs);
> - if (ret < 0) {
> - pr_warning("Failed to get the offset of %s.\n", field->name);
> - return ret;
> + if (tag == DW_TAG_union_type) {
> + offs = 0;
> + } else {
> + ret = die_get_data_member_location(die_mem, &offs);
> + if (ret < 0) {
> + pr_warning("Failed to get the offset of %s.\n",
> + field->name);
> + return ret;
> + }
> }
> ref->offset += (long)offs;
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@...achi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists