commit ffb40c659a690f4341e43051f6d5114732b3fe46 Author: Frank Ch. Eigler Date: Thu Mar 5 07:17:04 2020 -0500 RHBZ1810216: fix ftrace() tapset function related autoconf test It was reported that the ftrace() tapset function stopped working at some point - due to an autoconf-* false negative. We failed to notice because the tapset function was quietly mapped to a nop in this case. Now ftrace() will #error in -p4 if autoconf doesn't detect a suitable kernel facility. A forked testcase buildok/logging-embedded2.stp checks for it. Suggested-by: Oleksandr Natalenko diff --git a/runtime/linux/autoconf-trace-printk.c b/runtime/linux/autoconf-trace-printk.c index 8330a58..c7515bc 100644 --- a/runtime/linux/autoconf-trace-printk.c +++ b/runtime/linux/autoconf-trace-printk.c @@ -1,4 +1,5 @@ #include +#include int bar (void) { static char *fmt = "%s\n"; diff --git a/tapset/linux/logging.stp b/tapset/linux/logging.stp index 6192cf6..b13b5cc 100644 --- a/tapset/linux/logging.stp +++ b/tapset/linux/logging.stp @@ -25,6 +25,8 @@ function ftrace (msg:string) %{ /* unmodified-fnargs */ to defeat trace_printk -> __trace_bprintk optimization. That's because bprintk doesn't save the incoming strings, only their addresses. */ +#else + #error "trace_printk not supported" #endif %} diff --git a/testsuite/buildok/logging-embedded.stp b/testsuite/buildok/logging-embedded.stp index c97bd5a..7e2f15d 100755 --- a/testsuite/buildok/logging-embedded.stp +++ b/testsuite/buildok/logging-embedded.stp @@ -8,6 +8,6 @@ probe begin { exit() error("error") stp_print_binary(1, 0, 0, 0, 0) - ftrace("ftrace") + // ftrace() tested in logging-embedded2.stp printk(0,"Zoink! The paper tape punch is burning chads!") } diff --git a/testsuite/buildok/logging-embedded2.stp b/testsuite/buildok/logging-embedded2.stp new file mode 100755 index 0000000..528d5d0 --- /dev/null +++ b/testsuite/buildok/logging-embedded2.stp @@ -0,0 +1,7 @@ +#! stap -gp4 + +// build-test the logging tapset functions - ftrace() only usable if STAPCONF detects it + +probe begin { + ftrace("ftrace") +}