From: Andi Kleen <ak@linux.intel.com>
To: linux-perf-users@vger.kernel.org
Cc: adrian.hunter@intel.com, namhyung@kernel.org, acme@kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH v1 06/10] perf: Add plumbling for line/disc for inlines
Date: Thu, 5 Sep 2024 08:08:00 -0700 [thread overview]
Message-ID: <20240905151058.2127122-7-ak@linux.intel.com> (raw)
In-Reply-To: <20240905151058.2127122-1-ak@linux.intel.com>
When resolving inlines save the line number and the discriminator for
later use. The line number is already in the string, but it's more
convenient to have it as a integer too. Used in future patches.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/srcline.c | 18 ++++++++++++------
tools/perf/util/srcline.h | 2 ++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 07df410b52e4..0b11e3fe3f11 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -46,6 +46,7 @@ static const char *srcline_dso_name(struct dso *dso)
}
static int inline_list__append(struct symbol *symbol, char *srcline,
+ int line, int disc,
struct inline_node *node)
{
struct inline_list *ilist;
@@ -56,6 +57,8 @@ static int inline_list__append(struct symbol *symbol, char *srcline,
ilist->symbol = symbol;
ilist->srcline = srcline;
+ ilist->disc = disc;
+ ilist->line = line;
if (callchain_param.order == ORDER_CALLEE)
list_add_tail(&ilist->list, &node->val);
@@ -297,7 +300,8 @@ static int inline_list__append_dso_a2l(struct dso *dso,
if (a2l->filename)
srcline = srcline_from_fileline(a2l->filename, a2l->line);
- return inline_list__append(inline_sym, srcline, node);
+ return inline_list__append(inline_sym, srcline, a2l->line,
+ a2l->discriminator, node);
}
static int addr2line(const char *dso_name, u64 addr,
@@ -636,11 +640,12 @@ static int inline_list__append_record(struct dso *dso,
struct symbol *sym,
const char *function,
const char *filename,
- unsigned int line_nr)
+ unsigned int line_nr,
+ unsigned int disc)
{
struct symbol *inline_sym = new_inline_sym(dso, sym, function);
- return inline_list__append(inline_sym, srcline_from_fileline(filename, line_nr), node);
+ return inline_list__append(inline_sym, srcline_from_fileline(filename, line_nr), line_nr, disc, node);
}
static int addr2line(const char *dso_name, u64 addr,
@@ -750,7 +755,8 @@ static int addr2line(const char *dso_name, u64 addr,
if (node && inline_list__append_record(dso, node, sym,
record_function,
record_filename,
- record_line_nr)) {
+ record_line_nr,
+ disc)) {
ret = 0;
goto out;
}
@@ -768,12 +774,12 @@ static int addr2line(const char *dso_name, u64 addr,
/*first=*/false,
&record_function,
&record_filename,
- &record_line_nr, NULL)) == 1) {
+ &record_line_nr, &disc)) == 1) {
if (unwind_inlines && node && inline_count++ < MAX_INLINE_NEST) {
if (inline_list__append_record(dso, node, sym,
record_function,
record_filename,
- record_line_nr)) {
+ record_line_nr, disc)) {
ret = 0;
goto out;
}
diff --git a/tools/perf/util/srcline.h b/tools/perf/util/srcline.h
index d2cb90b1177e..5d37fcc7c02c 100644
--- a/tools/perf/util/srcline.h
+++ b/tools/perf/util/srcline.h
@@ -32,6 +32,8 @@ extern char *srcline__unknown;
struct inline_list {
struct symbol *symbol;
char *srcline;
+ int line;
+ int disc;
struct list_head list;
};
--
2.45.2
next prev parent reply other threads:[~2024-09-05 15:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 15:07 [RESEND] More dwarf support in python interface Andi Kleen
2024-09-05 15:07 ` [PATCH v1 01/10] perf: Avoid buffer overflow in python register interface Andi Kleen
2024-09-05 15:07 ` [PATCH v1 02/10] perf: Support discriminator in addr2line Andi Kleen
2024-09-05 15:07 ` [PATCH v1 03/10] perf: Plumb passing machine to scripts Andi Kleen
2024-09-05 15:07 ` [PATCH v1 04/10] perf: Add perf_brstack_srcline to resolve brstack entries Andi Kleen
2024-09-05 15:07 ` [PATCH v1 05/10] perf: Add perf_resolve_ip python interface Andi Kleen
2024-09-05 15:08 ` Andi Kleen [this message]
2024-09-05 15:08 ` [PATCH v1 07/10] perf: Support returning inlines in get_srcline_split Andi Kleen
2024-09-05 15:08 ` [PATCH v1 08/10] perf: resolve inlines for perf_brstack_srcline/perf_ip_srcline Andi Kleen
2024-09-05 15:08 ` [PATCH v1 09/10] perf: Add build id and filename to perf_brstack/ip_srcline Andi Kleen
2024-09-05 15:08 ` [PATCH v1 10/10] perf: Update documentation for new python callbacks Andi Kleen
2024-09-05 15:25 ` [RESEND] More dwarf support in python interface 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=20240905151058.2127122-7-ak@linux.intel.com \
--to=ak@linux.intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=linux-perf-users@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).