linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] libtracefs: Update tracing_dir in loading mapping files
Date: Mon, 12 Apr 2021 10:43:49 -0400	[thread overview]
Message-ID: <20210412104349.4d8f83b8@gandalf.local.home> (raw)

From 7209fe6bc43f79cb8d900ddb801050ff20e9b5a0 Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Date: Mon, 12 Apr 2021 10:37:49 -0400
Subject: [PATCH] libtracefs: Update tracing_dir in loading mapping files

If tracing_dir is not a path to a tracing dir or simply NULL, then
load_saved_cmdlines() and load_printk_formats() will fail to load any
mappings.

Add a check for tracing_dir in the callers of those functions
(load_mappings() and tracefs_load_cmdlines()) to update tracing_dir to the
appropriate directory.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 src/tracefs-events.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/tracefs-events.c b/src/tracefs-events.c
index 3a6196b..2d90739 100644
--- a/src/tracefs-events.c
+++ b/src/tracefs-events.c
@@ -661,12 +661,27 @@ static void load_mappings(const char *tracing_dir,
 			  struct tep_handle *tep)
 {
 	load_kallsyms(tep);
+
+	/* If there's no tracing_dir no reason to go further */
+	if (!tracing_dir)
+		tracing_dir = tracefs_tracing_dir();
+
+	if (!tracing_dir)
+		return;
+
 	load_saved_cmdlines(tracing_dir, tep, false);
 	load_printk_formats(tracing_dir, tep);
 }
 
 int tracefs_load_cmdlines(const char *tracing_dir, struct tep_handle *tep)
 {
+
+	if (!tracing_dir)
+		tracing_dir = tracefs_tracing_dir();
+
+	if (!tracing_dir)
+		return -1;
+
 	return load_saved_cmdlines(tracing_dir, tep, true);
 }
 
-- 
2.29.2


                 reply	other threads:[~2021-04-12 14:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210412104349.4d8f83b8@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@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;
as well as URLs for NNTP newsgroup(s).