* [PATCH] libtracefs: Update tracing_dir in loading mapping files
@ 2021-04-12 14:43 Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-04-12 14:43 UTC (permalink / raw)
To: Linux Trace Devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-12 14:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 14:43 [PATCH] libtracefs: Update tracing_dir in loading mapping files Steven Rostedt
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).