lkml.org 
[lkml]   [2017]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] perf-probe: Skip searching debuginfo if we know no debuginfo
Date
Skip searching debuginfo if we have already searched and
there is no debuginfo for given file.
This also reduce debuginfo mismatch warnings for listing
events on same binary.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
tools/perf/util/probe-finder.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 5bb71e056b21..cafc3e5b9863 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -119,6 +119,8 @@ enum dso_binary_type distro_dwarf_types[] = {

struct debuginfo *debuginfo__new(const char *path)
{
+ static struct strlist *no_debuginfo_files;
+
u8 bid[BUILD_ID_SIZE], bid2[BUILD_ID_SIZE];
enum dso_binary_type *type;
char buf[PATH_MAX], nil = '\0';
@@ -126,6 +128,12 @@ struct debuginfo *debuginfo__new(const char *path)
bool have_build_id = false;
struct debuginfo *dinfo = NULL;

+ /* Skip if we already know it has no debuginfo */
+ if (!no_debuginfo_files)
+ no_debuginfo_files = strlist__new(NULL, NULL);
+ else if (strlist__find(no_debuginfo_files, path))
+ return NULL;
+
/* Try to open distro debuginfo files */
dso = dso__new(path);
if (!dso)
@@ -159,7 +167,13 @@ struct debuginfo *debuginfo__new(const char *path)

out:
/* if failed to open all distro debuginfo, open given binary */
- return dinfo ? : __debuginfo__new(path);
+ if (!dinfo) {
+ dinfo = __debuginfo__new(path);
+ if (!dinfo)
+ strlist__add(no_debuginfo_files, path);
+ }
+
+ return dinfo;
}

void debuginfo__delete(struct debuginfo *dbg)
\
 
 \ /
  Last update: 2017-12-18 08:30    [W:0.037 / U:19.168 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site