[PATCH] trace-cmd: Make the minimum libtraceevent version 1.9

Steven Rostedt <[email protected]> Wed, 4 Feb 2026 15:20:26 -0500
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
From: "Steven Rostedt (Google)" <[email protected]>

Have libtraceevent minimum version be 1.9 and remove checks to use BTF
parsing, as 1.9 now has that.

Signed-off-by: Steven Rostedt (Google) <[email protected]>
---
 Makefile                     | 11 +----------
 lib/trace-cmd/trace-ftrace.c | 15 ---------------
 lib/trace-cmd/trace-input.c  |  7 -------
 meson.build                  |  5 +----
 tracecmd/trace-list.c        | 20 +-------------------
 5 files changed, 3 insertions(+), 55 deletions(-)

diff --git a/Makefile b/Makefile
index aea6a1aae111..c3707ae19d83 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ export LIBTRACECMD_VERSION
 
 VERSION_FILE = ltc_version.h
 
-LIBTRACEEVENT_MIN_VERSION = 1.5
+LIBTRACEEVENT_MIN_VERSION = 1.9
 LIBTRACEFS_MIN_VERSION = 1.8
 
 MAKEFLAGS += --no-print-directory
@@ -230,8 +230,6 @@ LIBTRACEFS=libtracefs
 TEST_LIBTRACEEVENT := $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
 TEST_LIBTRACEFS := $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) $(LIBTRACEFS) > /dev/null 2>&1 && echo y")
 
-TEST_LIBTRACEEVENT_BTF := $(shell sh -c "$(PKG_CONFIG) --atleast-version 1.9 $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
-
 ifeq ("$(TEST_LIBTRACEEVENT)", "y")
 LIBTRACEEVENT_CFLAGS := $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
 LIBTRACEEVENT_LDLAGS := $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
@@ -249,13 +247,6 @@ warning:
 	@echo "********************************************"
 endif
 
-ifeq ("$(TEST_LIBTRACEEVENT_BTF)", "y")
-CFLAGS += -DHAVE_KERNEL_BTF
-else
-.PHONY: warning
-$(info    Min version libtraceevent 1.9 not found. Will not use BTF for function args)
-endif
-
 export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS
 
 ifeq ("$(TEST_LIBTRACEFS)", "y")
diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c
index c874113bc66e..53c958653c28 100644
--- a/lib/trace-cmd/trace-ftrace.c
+++ b/lib/trace-cmd/trace-ftrace.c
@@ -220,22 +220,7 @@ static bool print_args(struct trace_seq *s, struct tep_event *event,
 
 	args = record->data + field->offset;
 
-#ifdef HAVE_KERNEL_BTF
 	tep_btf_print_args(event->tep, s, args, len, long_size, func);
-#else
-	for (int i = 0; i < len; i++) {
-		void *arg;
-
-		if (i)
-			trace_seq_puts(s, ", ");
-
-		arg = args + i * long_size;
-		if (long_size == 4)
-			trace_seq_printf(s, "%x", *(unsigned int *)arg);
-		else
-			trace_seq_printf(s, "%llx", *(unsigned long long *)arg);
-	}
-#endif
 
 	return true;
 }
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 22990430f14b..0fa9d9564bd7 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1026,7 +1026,6 @@ static int read_ftrace_printk(struct tracecmd_input *handle)
 	return 0;
 }
 
-#ifdef HAVE_KERNEL_BTF
 static int read_btf(struct tracecmd_input *handle)
 {
 	void *raw_data;
@@ -1041,12 +1040,6 @@ static int read_btf(struct tracecmd_input *handle)
 	free(raw_data);
 	return 0;
 }
-#else
-static inline int read_btf(struct tracecmd_input *handle)
-{
-	return 0;
-}
-#endif
 
 static int read_modules(struct tracecmd_input *handle)
 {
diff --git a/meson.build b/meson.build
index c86d1a6b7f0b..67d4681da471 100644
--- a/meson.build
+++ b/meson.build
@@ -24,12 +24,9 @@ htmldir = join_paths(prefixdir, get_option('htmldir'))
 
 conf = configuration_data()
 
-libtraceevent_dep = dependency('libtraceevent', version: '>= 1.5.0', required: true)
-libtraceevent_btf_dep = dependency('libtraceevent', version: '>= 1.9', required: false)
+libtraceevent_dep = dependency('libtraceevent', version: '>= 1.9.0', required: true)
 libtracefs_dep = dependency('libtracefs', version: '>= 1.8.0', required: true)
 
-conf.set('HAVE_KERNEL_BTF', libtraceevent_btf_dep.found(), description: 'Is BTF parsing available?')
-
 threads_dep = dependency('threads', required: true)
 dl_dep = cc.find_library('dl', required : false)
 
diff --git a/tracecmd/trace-list.c b/tracecmd/trace-list.c
index 50b6a1d99ea9..da2604ed1b2e 100644
--- a/tracecmd/trace-list.c
+++ b/tracecmd/trace-list.c
@@ -476,7 +476,6 @@ static void show_clocks(void)
 	free(clocks);
 }
 
-#ifdef HAVE_KERNEL_BTF
 static struct tep_handle *load_btf(void)
 {
 	struct tep_handle *tep;
@@ -520,23 +519,6 @@ static struct tep_handle *load_btf(void)
 	return tep;
 }
 
-static int btf_list_args(struct tep_handle *tep, struct trace_seq *s,
-			 const char *func)
-{
-	return tep_btf_list_args(tep, s, func);
-}
-#else
-static inline struct tep_handle *load_btf(void)
-{
-	return NULL;
-}
-static int btf_list_args(struct tep_handle *tep, struct trace_seq *s,
-			 const char *func)
-{
-	return 0;
-}
-#endif
-
 static void show_functions(const char *funcre, int params)
 {
 	struct tep_handle *tep = NULL;
@@ -585,7 +567,7 @@ static void show_functions(const char *funcre, int params)
 		printf("%s", list[i]);
 		if (params) {
 			trace_seq_reset(&s);
-			if (btf_list_args(tep, &s, list[i]) >= 0) {
+			if (tep_btf_list_args(tep, &s, list[i]) >= 0) {
 				printf("(");
 				trace_seq_do_printf(&s);
 				printf(")");
-- 
2.51.0