[DTrace-devel] [PATCH v2] btf: ensure BTF-to-CTF conversion works for modules

Kris Van Hees kris.van.hees at oracle.com
Thu Jul 25 16:46:12 UTC 2024


The recent introduction of code to always load BTF data for modules
broke the BTF-to-CTF conversion for modules.  This patch ensures that
the BTF-to-CTF convertor code is called from any module that does not
contain CTF data.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_module.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
index 5e608446..dc00aa88 100644
--- a/libdtrace/dt_module.c
+++ b/libdtrace/dt_module.c
@@ -963,7 +963,6 @@ dt_kern_module_find_ctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
 				   "looking for in-module CTF instead.\n",
 				   ctfa_name, ctf_errmsg(dtp->dt_ctferr));
 #endif
-			return;
 		}
 
 		if (dtp->dt_ctfa_path == NULL)
@@ -1018,6 +1017,11 @@ dt_kern_module_find_ctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
 
 		dmp->dm_flags |= DT_DM_CTF_ARCHIVED;
 		ctf_setspecific(dmp->dm_ctfp, dmp);
+#ifdef HAVE_LIBCTF
+	} else {
+		/* Generate CTF from BTF for the module. */
+		dt_kern_module_ctf_from_btf(dtp, dmp);
+#endif
 	}
 
 	/*
-- 
2.42.0




More information about the DTrace-devel mailing list