linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [BUGFIX PATCH 1/3] perf/probe: Fix to find range-only function instance
Date: Thu, 24 Oct 2019 18:12:36 +0900	[thread overview]
Message-ID: <157190835669.1859.8368628035930950596.stgit@devnote2> (raw)
In-Reply-To: <157190834681.1859.7399361844806238387.stgit@devnote2>

Fix die_is_func_instance() to find range-only function instance.

In some case, a function instance can be made without any low PC
or entry PC, but only with address ranges by optimization.
(e.g. cold text partially in "text.unlikely" section)
To find such function instance, we have to check the range
attribute too.

Fixes: e1ecbbc3fa83 ("perf probe: Fix to handle optimized not-inlined functions")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/perf/util/dwarf-aux.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index df6cee5c071f..2ec24c3bed44 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -318,10 +318,14 @@ bool die_is_func_def(Dwarf_Die *dw_die)
 bool die_is_func_instance(Dwarf_Die *dw_die)
 {
 	Dwarf_Addr tmp;
+	Dwarf_Attribute attr_mem;
 
 	/* Actually gcc optimizes non-inline as like as inlined */
-	return !dwarf_func_inline(dw_die) && dwarf_entrypc(dw_die, &tmp) == 0;
+	return !dwarf_func_inline(dw_die) &&
+	       (dwarf_entrypc(dw_die, &tmp) == 0 ||
+		dwarf_attr(dw_die, DW_AT_ranges, &attr_mem) != NULL);
 }
+
 /**
  * die_get_data_member_location - Get the data-member offset
  * @mb_die: a DIE of a member of a data structure


  reply	other threads:[~2019-10-24  9:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24  9:12 [BUGFIX PATCH 0/3] perf/probe: Fix available line bugs Masami Hiramatsu
2019-10-24  9:12 ` Masami Hiramatsu [this message]
2019-11-12 11:18   ` [tip: perf/core] perf probe: Fix to find range-only function instance tip-bot2 for Masami Hiramatsu
2019-10-24  9:12 ` [BUGFIX PATCH 2/3] perf/probe: Walk function lines in lexical blocks Masami Hiramatsu
2019-11-12 11:18   ` [tip: perf/core] perf probe: " tip-bot2 for Masami Hiramatsu
2019-10-24  9:12 ` [BUGFIX PATCH 3/3] perf/probe: Fix to show function entry line as probe-able Masami Hiramatsu
2019-11-12 11:18   ` [tip: perf/core] perf probe: " tip-bot2 for Masami Hiramatsu
2019-10-24 13:43 ` [BUGFIX PATCH 0/3] perf/probe: Fix available line bugs Arnaldo Carvalho de Melo
2019-10-24 15:36   ` Masami Hiramatsu
2019-10-24 20:23     ` Arnaldo Carvalho de Melo
2019-10-24 23:22       ` Masami Hiramatsu

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=157190835669.1859.8368628035930950596.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@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;
as well as URLs for NNTP newsgroup(s).