linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -tip/perf/core] perf probe: Add union member access support
@ 2012-09-12  7:57 Hyeoncheol Lee
  2012-09-12  8:35 ` Namhyung Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hyeoncheol Lee @ 2012-09-12  7:57 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel

Union members can be accessed with '.' or '->' like data structure
member access

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;

-- 
1.7.10

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip/perf/core] perf probe: Add union member access support
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2012-09-12  8:35 UTC (permalink / raw)
  To: Hyeoncheol Lee; +Cc: acme, linux-kernel

Hi Hyeoncheol,

It seems you don't use git send-email which adds people on Cc: lines of
changelog into actual CC list automatically.  Or did you send the email
to Masami and Srikar privately?

Thanks,
Namhyung


On Wed, 12 Sep 2012 16:57:45 +0900, Hyeoncheol Lee wrote:
> Union members can be accessed with '.' or '->' like data structure
> member access
>
> 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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip/perf/core] perf probe: Add union member access support
  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
  2012-09-12 17:09 ` Arnaldo Carvalho de Melo
  2012-09-19 15:10 ` [tip:perf/core] " tip-bot for Hyeoncheol Lee
  3 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2012-09-12 15:15 UTC (permalink / raw)
  To: Hyeoncheol Lee; +Cc: acme, linux-kernel, yrl.pp-manager.tt

(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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -tip/perf/core] perf probe: Add union member access support
  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
@ 2012-09-12 17:09 ` Arnaldo Carvalho de Melo
  2012-09-19 15:10 ` [tip:perf/core] " tip-bot for Hyeoncheol Lee
  3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-09-12 17:09 UTC (permalink / raw)
  To: Hyeoncheol Lee; +Cc: linux-kernel

Em Wed, Sep 12, 2012 at 04:57:45PM +0900, Hyeoncheol Lee escreveu:
> +++ b/tools/perf/util/probe-finder.c
> @@ -525,8 +525,10 @@ static int convert_variable_fields(Dwarf_Die
> *vr_die, const char *varname,


[acme@sandy linux]$ am /wb/1.patch 
Applying: perf probe: Add union member access support
fatal: corrupt patch at line 10
Patch failed at 0001 perf probe: Add union member access support
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
[acme@sandy linux]$ git am --abort
[acme@sandy linux]$ patch -p1 < /wb/1.patch 
patching file tools/perf/util/probe-finder.c
patch: **** malformed patch at line 60: *vr_die, const char *varname,

[acme@sandy linux]$

I'm fixing this up for you this time, but please fix your MUA.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf probe: Add union member access support
  2012-09-12  7:57 [PATCH -tip/perf/core] perf probe: Add union member access support Hyeoncheol Lee
                   ` (2 preceding siblings ...)
  2012-09-12 17:09 ` Arnaldo Carvalho de Melo
@ 2012-09-19 15:10 ` tip-bot for Hyeoncheol Lee
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Hyeoncheol Lee @ 2012-09-19 15:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, hyc.lee, masami.hiramatsu.pt,
	srikar, tglx

Commit-ID:  7b0295b3db20a89b3296673871858b9ab6b68404
Gitweb:     http://git.kernel.org/tip/7b0295b3db20a89b3296673871858b9ab6b68404
Author:     Hyeoncheol Lee <hyc.lee@gmail.com>
AuthorDate: Wed, 12 Sep 2012 16:57:45 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 14 Sep 2012 15:48:08 -0300

perf probe: Add union member access support

Union members can be accessed with '.' or '->' like data structure
member access

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/CANFS6baeuSBxPGQ8SUZWZErJ2bWs-Nojg+FSo138E1QK8bJJig@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-finder.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 526ba56..1daf5c1 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;
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-19 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-09-12 17:09 ` Arnaldo Carvalho de Melo
2012-09-19 15:10 ` [tip:perf/core] " tip-bot for Hyeoncheol Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).