|
|
045c8b |
commit ecab2afea46099b4e7dfd551462689224afdbe3a
|
|
|
045c8b |
Author: Stan Cox <scox@redhat.com>
|
|
|
045c8b |
Date: Wed Dec 1 16:19:22 2021 -0500
|
|
|
045c8b |
|
|
|
045c8b |
Handle user supplied sdt probe argument template
|
|
|
045c8b |
|
|
|
045c8b |
User supplied templates were erroneously removed by commit eaa15b047,
|
|
|
045c8b |
which complicated the template expansion. To do the above the
|
|
|
045c8b |
expansion of STAP_PROBE_ASM(provider, fooprobe,
|
|
|
045c8b |
STAP_PROBE_ASM_TEMPLATE(3)) adds an unused argument:
|
|
|
045c8b |
STAP_PROBE_ASM(provider, fooprobe, /*template expansion*/ "%[SDT..]..",
|
|
|
045c8b |
"use _SDT_ASM_TEMPLATE") A supplied template
|
|
|
045c8b |
STAP_PROBE_ASM(provider, fooprobe, "4@%rdx 8@%rax") is left alone. If
|
|
|
045c8b |
the varargs has 2 args (the fake "use ..") then macro expansion
|
|
|
045c8b |
inserts the expanded string, otherwise "4@.." becomes an ascii op.
|
|
|
045c8b |
|
|
|
045c8b |
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
|
|
|
045c8b |
index 28d236d91..24d5e01c3 100644
|
|
|
045c8b |
--- a/includes/sys/sdt.h
|
|
|
045c8b |
+++ b/includes/sys/sdt.h
|
|
|
045c8b |
@@ -290,7 +290,7 @@ __extension__ extern unsigned long long __sdt_unsp;
|
|
|
045c8b |
_SDT_ASM_1(.purgem _SDT_TYPE_) \
|
|
|
045c8b |
_SDT_ASM_1(.purgem _SDT_TYPE)
|
|
|
045c8b |
|
|
|
045c8b |
-#define _SDT_ASM_BODY(provider, name, pack_args, args) \
|
|
|
045c8b |
+#define _SDT_ASM_BODY(provider, name, pack_args, args, ...) \
|
|
|
045c8b |
_SDT_DEF_MACROS \
|
|
|
045c8b |
_SDT_ASM_1(990: _SDT_NOP) \
|
|
|
045c8b |
_SDT_ASM_3( .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \
|
|
|
045c8b |
@@ -417,9 +417,9 @@ __extension__ extern unsigned long long __sdt_unsp;
|
|
|
045c8b |
counted, so we don't have to worry about the behavior of macros
|
|
|
045c8b |
called without any arguments. */
|
|
|
045c8b |
|
|
|
045c8b |
-#ifdef SDT_USE_VARIADIC
|
|
|
045c8b |
#define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0)
|
|
|
045c8b |
#define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N
|
|
|
045c8b |
+#ifdef SDT_USE_VARIADIC
|
|
|
045c8b |
#define _SDT_PROBE_N(provider, name, N, ...) \
|
|
|
045c8b |
_SDT_PROBE(provider, name, N, (__VA_ARGS__))
|
|
|
045c8b |
#define STAP_PROBEV(provider, name, ...) \
|
|
|
045c8b |
@@ -468,9 +468,15 @@ __extension__ extern unsigned long long __sdt_unsp;
|
|
|
045c8b |
Note that these can use operand templates like %0 or %[name],
|
|
|
045c8b |
and likewise they must write %%reg for a literal operand of %reg. */
|
|
|
045c8b |
|
|
|
045c8b |
+#define _SDT_ASM_BODY_1(p,n,...) _SDT_ASM_BODY(p,n,_SDT_ASM_SUBSTR,(__VA_ARGS__))
|
|
|
045c8b |
+#define _SDT_ASM_BODY_2(p,n,...) _SDT_ASM_BODY(p,n,/*_SDT_ASM_STRING */,__VA_ARGS__)
|
|
|
045c8b |
+#define _SDT_ASM_BODY_N2(p,n,no,...) _SDT_ASM_BODY_ ## no(p,n,__VA_ARGS__)
|
|
|
045c8b |
+#define _SDT_ASM_BODY_N1(p,n,no,...) _SDT_ASM_BODY_N2(p,n,no,__VA_ARGS__)
|
|
|
045c8b |
+#define _SDT_ASM_BODY_N(p,n,...) _SDT_ASM_BODY_N1(p,n,_SDT_NARG(0, __VA_ARGS__),__VA_ARGS__)
|
|
|
045c8b |
+
|
|
|
045c8b |
#if __STDC_VERSION__ >= 199901L
|
|
|
045c8b |
# define STAP_PROBE_ASM(provider, name, ...) \
|
|
|
045c8b |
- _SDT_ASM_BODY(provider, name, /*_SDT_ASM_STRING */, __VA_ARGS__) \
|
|
|
045c8b |
+ _SDT_ASM_BODY_N(provider, name, __VA_ARGS__) \
|
|
|
045c8b |
_SDT_ASM_BASE
|
|
|
045c8b |
# define STAP_PROBE_ASM_OPERANDS(n, ...) _SDT_ASM_OPERANDS_##n(__VA_ARGS__)
|
|
|
045c8b |
#else
|
|
|
045c8b |
@@ -478,7 +484,7 @@ __extension__ extern unsigned long long __sdt_unsp;
|
|
|
045c8b |
_SDT_ASM_BODY(provider, name, /* _SDT_ASM_STRING */, (args)) \
|
|
|
045c8b |
_SDT_ASM_BASE
|
|
|
045c8b |
#endif
|
|
|
045c8b |
-#define STAP_PROBE_ASM_TEMPLATE(n) _SDT_ASM_TEMPLATE_##n
|
|
|
045c8b |
+#define STAP_PROBE_ASM_TEMPLATE(n) _SDT_ASM_TEMPLATE_##n,"use _SDT_ASM_TEMPLATE_"
|
|
|
045c8b |
|
|
|
045c8b |
|
|
|
045c8b |
/* DTrace compatible macro names. */
|
|
|
045c8b |
diff --git a/testsuite/systemtap.base/sdt_casm.c b/testsuite/systemtap.base/sdt_casm.c
|
|
|
045c8b |
index 1cff23c5f..9b357086c 100644
|
|
|
045c8b |
--- a/testsuite/systemtap.base/sdt_casm.c
|
|
|
045c8b |
+++ b/testsuite/systemtap.base/sdt_casm.c
|
|
|
045c8b |
@@ -3,6 +3,7 @@
|
|
|
045c8b |
int main()
|
|
|
045c8b |
{
|
|
|
045c8b |
int x = 42;
|
|
|
045c8b |
+ int y = 43;
|
|
|
045c8b |
__asm__ __volatile__ (
|
|
|
045c8b |
STAP_PROBE_ASM(testsuite, probe0, STAP_PROBE_ASM_TEMPLATE(0))
|
|
|
045c8b |
);
|
|
|
045c8b |
@@ -10,5 +11,9 @@ int main()
|
|
|
045c8b |
STAP_PROBE_ASM(testsuite, probe1, STAP_PROBE_ASM_TEMPLATE(1))
|
|
|
045c8b |
:: STAP_PROBE_ASM_OPERANDS(1, x)
|
|
|
045c8b |
);
|
|
|
045c8b |
+ // Create a template to test explicit template support
|
|
|
045c8b |
+ __asm__ __volatile__ (
|
|
|
045c8b |
+ STAP_PROBE_ASM(testsuite, probe2, -4@%[ARG1] -4@%[ARG2])
|
|
|
045c8b |
+ :: [ARG1] "rm" (x), [ARG2] "rm" (y));
|
|
|
045c8b |
return 0;
|
|
|
045c8b |
}
|
|
|
045c8b |
diff --git a/testsuite/systemtap.base/sdt_casm.exp b/testsuite/systemtap.base/sdt_casm.exp
|
|
|
045c8b |
index 5791cb2b9..0cd1cb517 100644
|
|
|
045c8b |
--- a/testsuite/systemtap.base/sdt_casm.exp
|
|
|
045c8b |
+++ b/testsuite/systemtap.base/sdt_casm.exp
|
|
|
045c8b |
@@ -18,7 +18,8 @@ proc cleanup_handler { verbose } {
|
|
|
045c8b |
|
|
|
045c8b |
set script $srcdir/$subdir/$test.stp
|
|
|
045c8b |
set ::result_string {PASS: probe0
|
|
|
045c8b |
-PASS: probe1}
|
|
|
045c8b |
+PASS: probe1
|
|
|
045c8b |
+PASS: probe2}
|
|
|
045c8b |
|
|
|
045c8b |
set asm_flags [sdt_includes]
|
|
|
045c8b |
set asm_flags "$asm_flags additional_flags=-std=c99"
|
|
|
045c8b |
diff --git a/testsuite/systemtap.base/sdt_casm.stp b/testsuite/systemtap.base/sdt_casm.stp
|
|
|
045c8b |
index 4f2539c93..530a79175 100644
|
|
|
045c8b |
--- a/testsuite/systemtap.base/sdt_casm.stp
|
|
|
045c8b |
+++ b/testsuite/systemtap.base/sdt_casm.stp
|
|
|
045c8b |
@@ -10,3 +10,11 @@ probe process.mark("probe1")
|
|
|
045c8b |
else
|
|
|
045c8b |
printf("FAIL: %s (%d != 42)\n", $$name, $arg1)
|
|
|
045c8b |
}
|
|
|
045c8b |
+
|
|
|
045c8b |
+probe process.mark("probe2")
|
|
|
045c8b |
+{
|
|
|
045c8b |
+ if ($arg1 == 42 && $arg2 == 43)
|
|
|
045c8b |
+ printf("PASS: %s\n", $$name)
|
|
|
045c8b |
+ else
|
|
|
045c8b |
+ printf("FAIL: %s (%d/%d != 42/43)\n", $$name, $arg1, $arg2)
|
|
|
045c8b |
+}
|
|
|
045c8b |
commit 209b5a19c (HEAD -> master, origin/master, origin/HEAD)
|
|
|
045c8b |
Author: Stan Cox <scox@redhat.com>
|
|
|
045c8b |
Date: Tue Dec 7 09:55:01 2021 -0500
|
|
|
045c8b |
|
|
|
045c8b |
sys/sdt.h fp constraints: aarch64, s390
|
|
|
045c8b |
|
|
|
045c8b |
Remove float constraints as per commit 1d3653936 but for aarch64 and s390.
|
|
|
045c8b |
|
|
|
045c8b |
commit 1d3653936 (HEAD -> master, origin/master, origin/HEAD)
|
|
|
045c8b |
Author: Frank Ch. Eigler <fche@redhat.com>
|
|
|
045c8b |
Date: Mon Dec 6 12:06:06 2021 -0500
|
|
|
045c8b |
|
|
|
045c8b |
sys/sdt.h fp constraints cont'd, x86-64 edition
|
|
|
045c8b |
|
|
|
045c8b |
It appears that various versions of gcc continue to show signs of
|
|
|
045c8b |
confusion at our newly offered asm-operand alternatives for floating
|
|
|
045c8b |
point sdt.h marker parameters.
|
|
|
045c8b |
|
|
|
045c8b |
e.g., https://bugzilla.redhat.com/show_bug.cgi?id=2028798
|
|
|
045c8b |
|
|
|
045c8b |
We may need to restore previous constraints broadly, forcing the
|
|
|
045c8b |
compiler to plop floating point parameters into integer storage.
|
|
|
045c8b |
|
|
|
045c8b |
--- a/includes/sys/sdt.h
|
|
|
045c8b |
+++ b/includes/sys/sdt.h
|
|
|
045c8b |
@@ -102,9 +102,5 @@
|
|
|
045c8b |
# define STAP_SDT_ARG_CONSTRAINT nZr
|
|
|
045c8b |
# elif defined __x86_64__
|
|
|
045c8b |
-# define STAP_SDT_ARG_CONSTRAINT norfxy
|
|
|
045c8b |
-# elif defined __aarch64__
|
|
|
045c8b |
-# define STAP_SDT_ARG_CONSTRAINT norw
|
|
|
045c8b |
-# elif defined __s390__ || defined __s390x__
|
|
|
045c8b |
-# define STAP_SDT_ARG_CONSTRAINT norf
|
|
|
045c8b |
+# define STAP_SDT_ARG_CONSTRAINT norx
|
|
|
045c8b |
# else
|
|
|
045c8b |
# define STAP_SDT_ARG_CONSTRAINT nor
|