From: Lin Ming <ming.m.lin@intel.com>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] perf hists browser: Fix seg fault when annotate null symbol
Date: Tue, 12 Apr 2011 15:32:43 +0800 [thread overview]
Message-ID: <1302593563.29423.17.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <1302244286.4106.36.camel@minggr.sh.intel.com>
On Fri, 2011-04-08 at 14:31 +0800, Lin Ming wrote:
> In hists browser, press hotkey 'a' to annotate current symbol.
> Now it causes segment fault if 'a' is pressed on a null symbol.
>
> Here are 2 small bugs:
> - In perf_evsel__hists_browse, the condition check after 'a' is pressed
> is not correct, we should check ->sym instead of ->map.
> - In symbol__tui_annotate we must check whether sym is NULL or not
> before getting annotation structure.
>
> This patch fixes above 2 small bugs.
Hi, Arnaldo
Could you have a look at this segment fault fix?
Thanks,
Lin Ming
>
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> ---
> tools/perf/util/ui/browsers/annotate.c | 6 ++++--
> tools/perf/util/ui/browsers/hists.c | 2 +-
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
> index 8c17a87..15633d6 100644
> --- a/tools/perf/util/ui/browsers/annotate.c
> +++ b/tools/perf/util/ui/browsers/annotate.c
> @@ -256,10 +256,9 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
> int refresh)
> {
> struct objdump_line *pos, *n;
> - struct annotation *notes = symbol__annotation(sym);
> + struct annotation *notes;
> struct annotate_browser browser = {
> .b = {
> - .entries = ¬es->src->source,
> .refresh = ui_browser__list_head_refresh,
> .seek = ui_browser__list_head_seek,
> .write = annotate_browser__write,
> @@ -281,6 +280,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
>
> ui_helpline__push("Press <- or ESC to exit");
>
> + notes = symbol__annotation(sym);
> +
> list_for_each_entry(pos, ¬es->src->source, node) {
> struct objdump_line_rb_node *rbpos;
> size_t line_len = strlen(pos->line);
> @@ -291,6 +292,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
> rbpos->idx = browser.b.nr_entries++;
> }
>
> + browser.b.entries = ¬es->src->source,
> browser.b.width += 18; /* Percentage */
> ret = annotate_browser__run(&browser, evidx, refresh);
> list_for_each_entry_safe(pos, n, ¬es->src->source, node) {
> diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
> index 798efdc..5d767c6 100644
> --- a/tools/perf/util/ui/browsers/hists.c
> +++ b/tools/perf/util/ui/browsers/hists.c
> @@ -851,7 +851,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel,
> goto out_free_stack;
> case 'a':
> if (browser->selection == NULL ||
> - browser->selection->map == NULL ||
> + browser->selection->sym == NULL ||
> browser->selection->map->dso->annotate_warned)
> continue;
> goto do_annotate;
>
next prev parent reply other threads:[~2011-04-12 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 6:31 Lin Ming
2011-04-12 7:32 ` Lin Ming [this message]
2011-04-18 15:51 ` [tip:perf/urgent] " tip-bot for Lin Ming
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=1302593563.29423.17.camel@minggr.sh.intel.com \
--to=ming.m.lin@intel.com \
--cc=acme@infradead.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome