All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
	peterz@infradead.org, fweisbec@gmail.com
Subject: Re: [PATCH] perf top: fix crash on annotate request
Date: Wed, 19 Oct 2011 16:12:32 -0600	[thread overview]
Message-ID: <4E9F4B50.1060207@gmail.com> (raw)
In-Reply-To: <20111019192011.GG2229@ghostprotocols.net>



Getting another crash with the default sym sorting -- the addr is much
less than the start of the sym so the offset goes negative:

(gdb) bt
#0  0x0000000000429de3 in symbol__inc_addr_samples (sym=0x8f0f90,
map=0x8aae00, evidx=0,
    addr=329985) at util/annotate.c:73
#1  0x000000000041b073 in record_precise_ip (he=0x8a2a10, counter=0,
ip=329985)
    at builtin-top.c:221
#2  0x000000000041c821 in perf_event__process_sample (event=0x7fffefbc74c8,
    sample=0x7fffffffe1b0, session=0x89a140) at builtin-top.c:801
#3  0x000000000041c8d4 in perf_session__mmap_read_idx (self=0x89a140,
idx=12)
    at builtin-top.c:821
#4  0x000000000041c95b in perf_session__mmap_read (self=0x89a140) at
builtin-top.c:832
#5  0x000000000041cdf1 in __cmd_top () at builtin-top.c:960
#6  0x000000000041d585 in cmd_top (argc=0, argv=0x7fffffffe590, prefix=0x0)
    at builtin-top.c:1252
#7  0x00000000004077b9 in run_builtin (p=0x75fb68, argc=2,
argv=0x7fffffffe590) at perf.c:286
#8  0x00000000004079bb in handle_internal_command (argc=2,
argv=0x7fffffffe590) at perf.c:358
#9  0x0000000000407b07 in run_argv (argcp=0x7fffffffe47c,
argv=0x7fffffffe470) at perf.c:402
#10 0x0000000000407dee in main (argc=2, argv=0x7fffffffe590) at perf.c:512


The following fixes the crash. If it seems reasonable I'll add to the
other one:

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index bc8f477..f1f20b5 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -63,6 +63,8 @@ int symbol__inc_addr_samples(struct symbol *sym,
struct map *map,
        return -ENOMEM;

    pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map,
addr));
+   if (addr < sym->start)
+       return 0;

    if (addr >= sym->end)
        return 0;


I'll combine

  parent reply	other threads:[~2011-10-19 22:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 18:23 [PATCH] perf top: fix crash on annotate request David Ahern
2011-10-19 18:38 ` Arnaldo Carvalho de Melo
2011-10-19 18:44   ` David Ahern
2011-10-19 19:20     ` Arnaldo Carvalho de Melo
2011-10-19 20:21       ` David Ahern
2011-10-19 21:39       ` David Ahern
2011-10-20 12:51         ` Arnaldo Carvalho de Melo
2011-10-19 22:12       ` David Ahern [this message]
2011-10-20 13:00         ` Arnaldo Carvalho de Melo
2011-10-20 14:15           ` David Ahern
2011-11-10 22:01           ` Brian Marete
2011-11-13 13:43             ` Arnaldo Carvalho de Melo
2011-11-13 21:03               ` Brian Marete
2011-11-13 21:42                 ` Brian Marete
2011-11-30 13:23             ` Brian Marete
2011-11-30 18:10               ` Arnaldo Carvalho de Melo
2011-12-01 13:17                 ` Brian Marete
2011-12-01 14:11                   ` Arnaldo Carvalho de Melo
2011-12-06  7:22                     ` Brian Gitonga Marete
2011-12-06 13:44                       ` Arnaldo Carvalho de Melo
2011-12-15 21:01                         ` Brian Gitonga Marete
2011-12-15 22:04                           ` Brian Gitonga Marete
2011-12-16 23:46                             ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2011-10-20 20:39 David Ahern
2011-10-20 21:30 ` Arnaldo Carvalho de Melo
2011-10-20 23:26 ` 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=4E9F4B50.1060207@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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.