All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, peterz@infradead.org, paulus@samba.org
Subject: perf annotate segfaults when source code has goto label that looks like hex number
Date: Thu, 22 Jul 2010 10:20:44 +0300	[thread overview]
Message-ID: <20100722072044.GD27177@redhat.com> (raw)

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.

             reply	other threads:[~2010-07-22  7:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22  7:20 Gleb Natapov [this message]
2010-07-22 14:33 ` [PATCH] Re: perf annotate segfaults when source code has goto label that looks like hex number 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

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=20100722072044.GD27177@redhat.com \
    --to=gleb@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /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.