public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* perf annotate segfaults when source code has goto label that looks like hex number
@ 2010-07-22  7:20 Gleb Natapov
  2010-07-22 14:33 ` [PATCH] " Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 12+ messages in thread
From: Gleb Natapov @ 2010-07-22  7:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz, paulus

The script below demonstrate this. The problem is in
hist_entry__parse_objdump_line():

        if (*tmp) {
                /*
                 * Parse hexa addresses followed by ':'
                 */
                line_ip = strtoull(tmp, &tmp2, 16);
                if (*tmp2 != ':' || tmp == tmp2)
                        line_ip = -1;
        }
 
strtoull() returns valid number when it gets line with label and following
test passes too. I can't think of a way to unambiguously distinguish between
label and valid rip. May be running objdump with --prefix-addresses will
help, but it may make other thing unambiguous.

=== script ===
cat > test.c << EOF
int main(int argc, char **argv)
{
	int i;

	while(1) {
		i++;
		if (i == 10000000)
			goto add;
	}
add:
	return 0;
}
EOF

gcc -g test.c
perf record ./a.out
perf annotate
--
			Gleb.

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

end of thread, other threads:[~2010-08-02 14:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22  7:20 perf annotate segfaults when source code has goto label that looks like hex number Gleb Natapov
2010-07-22 14:33 ` [PATCH] " Arnaldo Carvalho de Melo
2010-07-22 16:38   ` Gleb Natapov
2010-07-22 16:47     ` Arnaldo Carvalho de Melo
2010-07-22 16:52       ` Arnaldo Carvalho de Melo
2010-07-22 17:05         ` [PATCH v2] " Arnaldo Carvalho de Melo
2010-07-22 18:05           ` Gleb Natapov
2010-07-22 19:11             ` Arnaldo Carvalho de Melo
2010-07-22 19:16               ` Gleb Natapov
2010-08-02  9:02               ` Peter Zijlstra
2010-08-02 14:52                 ` Arnaldo Carvalho de Melo
2010-07-23 12:11           ` [tip:perf/urgent] perf annotate: Fix handling of goto labels that are valid hex numbers tip-bot for Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox