public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 3/3] dlibs: report missing CTF and BTF data for vmlinux
@ 2025-06-23 23:37 Kris Van Hees
  2025-06-24 14:18 ` [DTrace-devel] " Nick Alcock
  0 siblings, 1 reply; 4+ messages in thread
From: Kris Van Hees @ 2025-06-23 23:37 UTC (permalink / raw)
  To: dtrace, dtrace-devel

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@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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-15 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 23:37 [PATCH 3/3] dlibs: report missing CTF and BTF data for vmlinux Kris Van Hees
2025-06-24 14:18 ` [DTrace-devel] " Nick Alcock
2025-06-24 14:49   ` Kris Van Hees
2025-07-15 14:23     ` Nick Alcock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox