From: Chris Phlipot <cphlipot0@gmail.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: adrian.hunter@intel.com, peterz@infradead.org, mingo@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] perf tools: fix handling of zero-length symbols.
Date: Mon, 9 May 2016 10:51:24 -0700 [thread overview]
Message-ID: <5AB18302-4E55-47D2-96DC-14571CAA1865@gmail.com> (raw)
In-Reply-To: <20160509170631.GC5101@kernel.org>
> On May 9, 2016, at 10:06 AM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
>
> Em Sat, May 07, 2016 at 02:16:59AM -0700, Chris Phlipot escreveu:
>> This change introduces a fix to symbols__find, so that it is able to find
>> symbols of length zero (where start==end)
>>
>> The current code has the following problem:
>> -The current implementation of symbols__find is unable to find any symbols
>> of length zero.
>> -The db-export framework explicitly creates zero length symbols at
>> locations where no symbol currently exists.
>>
>> The combination of the two above behaviors results in behavior similar to
>> the example below.
>
> Ok, but you made the unlikely case be the first test, how about this one
> liner instead?
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 415c4f6d98fd..7a0917569fb3 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -301,7 +301,7 @@ static struct symbol *symbols__find(struct rb_root *symbols, u64 ip)
>
> if (ip < s->start)
> n = n->rb_left;
> - else if (ip >= s->end)
> + else if (ip > s->end || (ip == s->end && ip != s->start)
> n = n->rb_right;
> else
> return s;
>
>
I agree. This looks like a better fix.
>> +++ b/tools/perf/util/symbol.c
>> @@ -299,7 +299,9 @@ static struct symbol *symbols__find(struct rb_root *symbols, u64 ip)
>> while (n) {
>> struct symbol *s = rb_entry(n, struct symbol, rb_node);
>>
>> - if (ip < s->start)
>> + if (ip == s->start && s->start == s->end)
>> + return s;
>> + else if (ip < s->start)
>> n = n->rb_left;
>> else if (ip >= s->end)
>> n = n->rb_right;
>> --
>> 2.7.4
next prev parent reply other threads:[~2016-05-09 17:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-07 9:16 Chris Phlipot
2016-05-07 9:17 ` [PATCH 2/2] perf script: fix incorrect python db-export error message Chris Phlipot
2016-05-10 20:31 ` [tip:perf/core] perf script: Fix " tip-bot for Chris Phlipot
2016-05-09 17:06 ` [PATCH 1/2] perf tools: fix handling of zero-length symbols Arnaldo Carvalho de Melo
2016-05-09 17:51 ` Chris Phlipot [this message]
2016-05-10 20:33 ` [tip:perf/core] perf symbols: Fix " tip-bot for Chris Phlipot
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=5AB18302-4E55-47D2-96DC-14571CAA1865@gmail.com \
--to=cphlipot0@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=arnaldo.melo@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®