Skip to contentSkip to conversation

perf annotate: Don't truncate Intel style addresses

PATCH Applied Alex Converse 3 participants 3 messages Aug 14, 2014 – Aug 18, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf annotate: Don't truncate Intel style addresses

Instructions like "mov r9,QWORD PTR [rdx+0x8]" were being truncated to "mov r9,QWORD" by code that assuemd operands cannot have spaces.

---
 tools/perf/util/annotate.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tools/perf/util/annotate.c +9 -3
index 809b4c5..cc6f72c 100644
@@ -232,9 +232,16 @@ static int mov__parse(struct ins_operands *ops)
 		return -1;
 
 	target = ++s;
+	comment = strchr(s, '#');
 
-	while (s[0] != '\0' && !isspace(s[0]))
-		++s;
+	if (comment != NULL)
+		s = comment - 1;
+	else
+		s = strchr(s, '\0') - 1;
+
+	while (s > target && isspace(s[0]))
+		--s;
+	s++;
 	prev = *s;
 	*s = '\0';
 
@@ -244,7 +251,6 @@ static int mov__parse(struct ins_operands *ops)
 	if (ops->target.raw == NULL)
 		goto out_free_source;
 
-	comment = strchr(s, '#');
 	if (comment == NULL)
 		return 0;
 
Signature · 1 line
2.1.0.rc2.206.gedb03e5
maintainer Applied
#1 lore raw

Em Thu, Aug 14, 2014 at 02:03:00PM -0700, Alex Converse escreveu:

Quoted 4 lines

Instructions like "mov r9,QWORD PTR [rdx+0x8]" were being truncated to "mov r9,QWORD" by code that assuemd operands cannot have spaces.

Thanks, applied.

- Arnaldo

#2 lore raw

[tip:perf/core] perf annotate: Don' t truncate Intel style addresses

In reply to Alex Converse
perf annotate: Don't truncate Intel style addresses
Commit-ID:  1e2bb043f171084e5f34816a4268304512d35a46
Gitweb:     http://git.kernel.org/tip/1e2bb043f171084e5f34816a4268304512d35a46
Author:     Alex Converse <[email protected]>
AuthorDate: Thu, 14 Aug 2014 14:03:00 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 15 Aug 2014 10:39:26 -0300

perf annotate: Don't truncate Intel style addresses

Instructions like "mov r9,QWORD PTR [rdx+0x8]" were being truncated to "mov r9,QWORD" by code that assuemd operands cannot have spaces.

---
 tools/perf/util/annotate.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tools/perf/util/annotate.c +9 -3
index 7745fec..3643752 100644
@@ -232,9 +232,16 @@ static int mov__parse(struct ins_operands *ops)
 		return -1;
 
 	target = ++s;
+	comment = strchr(s, '#');
 
-	while (s[0] != '\0' && !isspace(s[0]))
-		++s;
+	if (comment != NULL)
+		s = comment - 1;
+	else
+		s = strchr(s, '\0') - 1;
+
+	while (s > target && isspace(s[0]))
+		--s;
+	s++;
 	prev = *s;
 	*s = '\0';
 
@@ -244,7 +251,6 @@ static int mov__parse(struct ins_operands *ops)
 	if (ops->target.raw == NULL)
 		goto out_free_source;
 
-	comment = strchr(s, '#');
 	if (comment == NULL)
 		return 0;