[DTrace-devel] [PATCH 3/3] dlibs: report missing CTF and BTF data for vmlinux

Kris Van Hees kris.van.hees at oracle.com
Mon Jun 23 23:37:21 UTC 2025


If the kernel is not compiled with CTF and/or BTF enabled, DTrace will
not work.  This used to result in an assert, which is rather harsh and
not user friendly.  We now report a nice error.

Doing this in the pragma 'depends on' handling may seem odd but that is
where the initial type data load is triggered.  If for some strange
reason no dlibs exist (and thus no 'depends on' are encountered), the
compiler will complain about missing type information anyway.

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

diff --git a/libdtrace/dt_pragma.c b/libdtrace/dt_pragma.c
index 0c97edfc..d29e6e28 100644
--- a/libdtrace/dt_pragma.c
+++ b/libdtrace/dt_pragma.c
@@ -202,7 +202,15 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
 		found = dt_provider_lookup(dtp, nnp->dn_string) != NULL;
 	else if (strcmp(cnp->dn_string, "module") == 0) {
 		dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
-		found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
+
+		if (mp == NULL)
+			found = B_FALSE;
+		else if (dt_module_getctf(dtp, mp) != NULL)
+			found = B_TRUE;
+		else
+			xyerror(D_SYM_NOTYPES,
+				"No type data (CTF or BTF) found for %s",
+				mp->dm_name);
 	} else if (strcmp(cnp->dn_string, "library") == 0) {
 		if (yypcb->pcb_cflags & DTRACE_C_CTL) {
 			assert(dtp->dt_filetag != NULL);
-- 
2.43.5




More information about the DTrace-devel mailing list