All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Hyeoncheol Lee <hyc.lee@gmail.com>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	yrl.pp-manager.tt@hitachi.com
Subject: Re: [PATCH -tip/perf/core] perf probe: Add union member access support
Date: Thu, 13 Sep 2012 00:15:06 +0900	[thread overview]
Message-ID: <5050A6FA.1080503@hitachi.com> (raw)
In-Reply-To: <CANFS6baeuSBxPGQ8SUZWZErJ2bWs-Nojg+FSo138E1QK8bJJig@mail.gmail.com>

(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@hitachi.com>

Thank you!

> 
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> Signed-off-by: Hyunchul Lee <hyc.lee@gmail.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@hitachi.com



  parent reply	other threads:[~2012-09-12 15:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12  7:57 [PATCH -tip/perf/core] perf probe: Add union member access support Hyeoncheol Lee
2012-09-12  8:35 ` Namhyung Kim
2012-09-12 15:15 ` Masami Hiramatsu [this message]
2012-09-12 17:09 ` Arnaldo Carvalho de Melo
2012-09-19 15:10 ` [tip:perf/core] " tip-bot for Hyeoncheol Lee

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=5050A6FA.1080503@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=acme@ghostprotocols.net \
    --cc=hyc.lee@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yrl.pp-manager.tt@hitachi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.