From e85c70f82c134bf18ae845e3b1bfc15415591225 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Mon, 2 Mar 2009 21:38:26 -0500 Subject: Allow the same static user probe to be used multiple times per line. * dtrace (provider): Add STAP_PROBE10. * includes/sys/sdt.h: Likewise. Convert labels to __label__ --- includes/sys/sdt.h | 56 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 15 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index d68fed6c..ef0977ea 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -43,30 +43,33 @@ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section // The goto _probe_ prevents the label from "drifting" #define STAP_PROBE(provider,probe) \ - { \ -STAP_LABEL(probe,__LINE__): \ + {__label__ STAP_LABEL(probe,__LINE__); \ +STAP_LABEL(probe,__LINE__): \ asm volatile ("nop"); \ STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ STAP_LABEL_REF(probe) \ } #define STAP_PROBE1(provider,probe,parm1) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ -STAP_LABEL(probe,__LINE__): \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ +STAP_LABEL(probe,__LINE__): \ asm volatile ("nop /* %0 */" :: "g"( arg1)); \ STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ STAP_LABEL_REF(probe);} #define STAP_PROBE2(provider,probe,parm1,parm2) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ STAP_LABEL(probe,__LINE__): \ asm volatile ("nop /* %0 %1 */" :: "g"(arg1), "g"(arg2)); \ STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ STAP_LABEL_REF(probe);} #define STAP_PROBE3(provider,probe,parm1,parm2,parm3) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ STAP_LABEL(probe,__LINE__): \ @@ -75,17 +78,19 @@ STAP_LABEL(probe,__LINE__): \ STAP_LABEL_REF(probe);} #define STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ STAP_LABEL(probe,__LINE__): \ asm volatile ("nop /* %0 %1 %2 %3 */" :: "g"(arg1), "g"(arg2), "g"(arg3), "g"(arg4)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ + STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ STAP_LABEL_REF(probe);} #define STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ @@ -96,7 +101,8 @@ STAP_LABEL(probe,__LINE__): \ STAP_LABEL_REF(probe);} #define STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ @@ -108,7 +114,8 @@ STAP_LABEL(probe,__LINE__): \ STAP_LABEL_REF(probe);} #define STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ @@ -121,7 +128,8 @@ STAP_LABEL(probe,__LINE__): \ STAP_LABEL_REF(probe);} #define STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ @@ -135,7 +143,8 @@ STAP_LABEL(probe,__LINE__): \ STAP_LABEL_REF(probe);} #define STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ @@ -149,6 +158,23 @@ STAP_LABEL(probe,__LINE__): \ STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ STAP_LABEL_REF(probe);} +#define STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ + {__label__ STAP_LABEL(probe,__LINE__); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ + volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ + volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ + volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ + volatile typeof((parm9)) arg9 __attribute__ ((unused)) = parm9; \ + volatile typeof((parm10)) arg10 __attribute__ ((unused)) = parm9; \ +STAP_LABEL(probe,__LINE__): \ + asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); \ + STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ + STAP_LABEL_REF(probe);} + #define DTRACE_PROBE(provider,probe) \ STAP_PROBE(provider,probe) #define DTRACE_PROBE1(provider,probe,parm1) \ @@ -169,5 +195,5 @@ STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) #define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) - #endif /* sys/sdt.h */ + -- cgit From c03f0c3d60d7ba465fe94ba60c26656f32287685 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Fri, 6 Mar 2009 07:37:56 -0500 Subject: Create unique named labels. * includes/sys/sdt.h (STAP_PROBEN_): New macros that take advantage of __COUNTER__ --- includes/sys/sdt.h | 159 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 94 insertions(+), 65 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index ef0977ea..1d41d878 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -33,88 +33,94 @@ static char probe ## _ ## probe_name [strlen(#probe)+1] \ = #probe; \ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,(size_t)& probe ## _ ## probe_name[0],argc}; -#define STAP_LABEL_REF(probe) \ +// The goto _probe_ prevents the label from "drifting" +#define STAP_LABEL_REF(probe, label) \ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__); + goto label; +// These baroque macros are used to create a unique label #define STAP_CONCAT(a,b) a ## b -#define STAP_LABEL(p,n) \ - STAP_CONCAT(_stapprobe1_ ## p ## _, n) +#define STAP_LABEL_PREFIX(p) _stapprobe1_ ## p +// __COUNTER__ is not present in gcc 4.1 +#if __GNUC__ == 4 && __GNUC_MINOR__ >= 3 +#define STAP_COUNTER STAP_CONCAT(__,COUNTER__) +#else +#define STAP_COUNTER STAP_CONCAT(__,LINE__) +#endif +#define STAP_LABEL(a,b) STAP_CONCAT(a,b) -// The goto _probe_ prevents the label from "drifting" -#define STAP_PROBE(provider,probe) \ - {__label__ STAP_LABEL(probe,__LINE__); \ -STAP_LABEL(probe,__LINE__): \ +#define STAP_PROBE_(probe,label) \ +do { \ +label: \ asm volatile ("nop"); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe) \ -} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE1(provider,probe,parm1) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE1_(probe,label,parm1) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop /* %0 */" :: "g"( arg1)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} +label: \ + asm volatile ("nop /* %0 */" :: "X"( arg1)); \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE2(provider,probe,parm1,parm2) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE2_(probe,label,parm1,parm2) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop /* %0 %1 */" :: "g"(arg1), "g"(arg2)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} +label: \ + asm volatile ("nop /* %0 %1 */" :: "X"(arg1), "X"(arg2)); \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE3(provider,probe,parm1,parm2,parm3) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE3_(probe,label,parm1,parm2,parm3) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop /* %0 %1 %2 */" :: "g"(arg1), "g"(arg2), "g"(arg3)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} +label: \ + asm volatile ("nop /* %0 %1 %2 */" :: "X"(arg1), "X"(arg2), "X"(arg3)); \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE4_(probe,label,parm1,parm2,parm3,parm4) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop /* %0 %1 %2 %3 */" :: "g"(arg1), "g"(arg2), "g"(arg3), "g"(arg4)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} +label: \ + asm volatile ("nop /* %0 %1 %2 %3 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4)); \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE5_(probe,label,parm1,parm2,parm3,parm4,parm5) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ -STAP_LABEL(probe,__LINE__): \ +label: \ asm volatile ("nop /* %0 %1 %2 %3 %4 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE6_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ -STAP_LABEL(probe,__LINE__): \ +label: \ asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE7_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -122,13 +128,13 @@ STAP_LABEL(probe,__LINE__): \ volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ -STAP_LABEL(probe,__LINE__): \ +label: \ asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE8_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -137,13 +143,13 @@ STAP_LABEL(probe,__LINE__): \ volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ -STAP_LABEL(probe,__LINE__): \ +label: \ asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE9_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -153,13 +159,13 @@ STAP_LABEL(probe,__LINE__): \ volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ volatile typeof((parm9)) arg9 __attribute__ ((unused)) = parm9; \ -STAP_LABEL(probe,__LINE__): \ +label: \ asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ - {__label__ STAP_LABEL(probe,__LINE__); \ +#define STAP_PROBE10_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ +do { \ volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -170,10 +176,33 @@ STAP_LABEL(probe,__LINE__): \ volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ volatile typeof((parm9)) arg9 __attribute__ ((unused)) = parm9; \ volatile typeof((parm10)) arg10 __attribute__ ((unused)) = parm9; \ -STAP_LABEL(probe,__LINE__): \ +label: \ asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); \ - STAP_PROBE_STRUCT(probe,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - STAP_LABEL_REF(probe);} + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ + STAP_LABEL_REF(probe,label);} while (0) + +#define STAP_PROBE(provider,probe,...) \ + STAP_PROBE_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE1(provider,probe,...) \ + STAP_PROBE1_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE2(provider,probe,...) \ + STAP_PROBE2_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE3(provider,probe,...) \ + STAP_PROBE3_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE4(provider,probe,...) \ + STAP_PROBE4_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE5(provider,probe,...) \ + STAP_PROBE5_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE6(provider,probe,...) \ + STAP_PROBE6_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE7(provider,probe,...) \ + STAP_PROBE7_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE8(provider,probe,...) \ + STAP_PROBE8_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE9(provider,probe,...) \ + STAP_PROBE9_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE10(provider,probe,...) \ + STAP_PROBE10_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) #define DTRACE_PROBE(provider,probe) \ STAP_PROBE(provider,probe) -- cgit From 63df184c9510561887771420a47cdc9c04b876f1 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 6 Mar 2009 19:21:44 +0100 Subject: STAP_PROBE takes no extra arguments. * includes/sys/sdt.h (STAP_PROBE): Don't add __VA_ARGS__. --- includes/sys/sdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index 1d41d878..4ebf4fe0 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -181,8 +181,8 @@ label: \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ STAP_LABEL_REF(probe,label);} while (0) -#define STAP_PROBE(provider,probe,...) \ - STAP_PROBE_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE(provider,probe) \ + STAP_PROBE_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER)) #define STAP_PROBE1(provider,probe,...) \ STAP_PROBE1_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) #define STAP_PROBE2(provider,probe,...) \ -- cgit From da573399d560fc659ee45ae041dcb2bf5b9b0bf6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 8 Mar 2009 20:56:18 +0100 Subject: Remove extra semi-colons from defines in sdt.h. * includes/sys/sdt.h (STAP_PROBE_STRUCT_ARG): Remove ending semi-colon. (STAP_LABEL_REF): Likewise. --- includes/sys/sdt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index 4ebf4fe0..8e27cfdb 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -13,10 +13,10 @@ #if _LP64 #define STAP_PROBE_STRUCT_ARG(arg) \ - __uint64_t arg; + __uint64_t arg #else #define STAP_PROBE_STRUCT_ARG(arg) \ - long arg __attribute__ ((aligned(8))); + long arg __attribute__ ((aligned(8))) #endif #define STAP_SENTINEL 0x31425250 @@ -36,7 +36,7 @@ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section // The goto _probe_ prevents the label from "drifting" #define STAP_LABEL_REF(probe, label) \ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto label; + goto label // These baroque macros are used to create a unique label #define STAP_CONCAT(a,b) a ## b -- cgit From 048cb0db9b075e3632e2372a754a68801c3e5ae9 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 8 Mar 2009 23:49:05 +0100 Subject: Only use plain C comments in sdt.h. includes/sys/sdt.h: Replace c++ comments with plain C comments. --- includes/sys/sdt.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index 8e27cfdb..46f259f5 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -1,10 +1,11 @@ -// Copyright (C) 2005-2009 Red Hat Inc. -// Copyright (C) 2006 Intel Corporation. -// -// This file is part of systemtap, and is free software. You can -// redistribute it and/or modify it under the terms of the GNU General -// Public License (GPL); either version 2, or (at your option) any -// later version. +/* Copyright (C) 2005-2009 Red Hat Inc. + Copyright (C) 2006 Intel Corporation. + + This file is part of systemtap, and is free software. You can + redistribute it and/or modify it under the terms of the GNU General + Public License (GPL); either version 2, or (at your option) any + later version. +*/ #ifndef _SYS_SDT_H #define _SYS_SDT_H 1 @@ -33,15 +34,15 @@ static char probe ## _ ## probe_name [strlen(#probe)+1] \ = #probe; \ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,(size_t)& probe ## _ ## probe_name[0],argc}; -// The goto _probe_ prevents the label from "drifting" +/* The goto _probe_ prevents the label from "drifting" */ #define STAP_LABEL_REF(probe, label) \ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ goto label -// These baroque macros are used to create a unique label +/* These baroque macros are used to create a unique label */ #define STAP_CONCAT(a,b) a ## b #define STAP_LABEL_PREFIX(p) _stapprobe1_ ## p -// __COUNTER__ is not present in gcc 4.1 +/* __COUNTER__ is not present in gcc 4.1 */ #if __GNUC__ == 4 && __GNUC_MINOR__ >= 3 #define STAP_COUNTER STAP_CONCAT(__,COUNTER__) #else -- cgit From 8e9f87b2c6e8e75e0f57f41f14879f803ec95545 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 9 Mar 2009 00:15:23 +0100 Subject: Put statements after declaration in sdt macros. Fix arg10 assignment. * includes/sys/sdt.h: Assign args, after declaration. --- includes/sys/sdt.h | 225 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 140 insertions(+), 85 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index 46f259f5..4eb54250 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -59,128 +59,183 @@ label: \ #define STAP_PROBE1_(probe,label,parm1) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ -label: \ - asm volatile ("nop /* %0 */" :: "X"( arg1)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ +label: \ + asm volatile ("nop /* %0 */" :: "X"( arg1)); } while (0) #define STAP_PROBE2_(probe,label,parm1,parm2) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ -label: \ - asm volatile ("nop /* %0 %1 */" :: "X"(arg1), "X"(arg2)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ +label: \ + asm volatile ("nop /* %0 %1 */" :: "X"(arg1), "X"(arg2)); } while (0) #define STAP_PROBE3_(probe,label,parm1,parm2,parm3) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ -label: \ - asm volatile ("nop /* %0 %1 %2 */" :: "X"(arg1), "X"(arg2), "X"(arg3)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ +label: \ + asm volatile ("nop /* %0 %1 %2 */" :: "X"(arg1), "X"(arg2), "X"(arg3)); } while (0) #define STAP_PROBE4_(probe,label,parm1,parm2,parm3,parm4) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ -label: \ - asm volatile ("nop /* %0 %1 %2 %3 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ +label: \ + asm volatile ("nop /* %0 %1 %2 %3 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4)); } while (0) #define STAP_PROBE5_(probe,label,parm1,parm2,parm3,parm4,parm5) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ -label: \ - asm volatile ("nop /* %0 %1 %2 %3 %4 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ + arg5 = parm5; \ +label: \ + asm volatile ("nop /* %0 %1 %2 %3 %4 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5)); } while (0) #define STAP_PROBE6_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ -label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ + volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ + arg5 = parm5; \ + arg6 = parm6; \ +label: \ + asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6)); } while (0) #define STAP_PROBE7_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ -label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ + volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ + volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ + arg5 = parm5; \ + arg6 = parm6; \ + arg7 = parm7; \ +label: \ + asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7)); } while (0) #define STAP_PROBE8_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ - volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ -label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ + volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ + volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ + volatile typeof((parm8)) arg8 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ + arg5 = parm5; \ + arg6 = parm6; \ + arg7 = parm7; \ + arg8 = parm8; \ +label: \ + asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8)); } while (0) #define STAP_PROBE9_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ - volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ - volatile typeof((parm9)) arg9 __attribute__ ((unused)) = parm9; \ -label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ + volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ + volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ + volatile typeof((parm8)) arg8 __attribute__ ((unused)); \ + volatile typeof((parm9)) arg9 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ + arg5 = parm5; \ + arg6 = parm6; \ + arg7 = parm7; \ + arg8 = parm8; \ + arg9 = parm9; \ +label: \ + asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9)); } while (0) #define STAP_PROBE10_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)) = parm7; \ - volatile typeof((parm8)) arg8 __attribute__ ((unused)) = parm8; \ - volatile typeof((parm9)) arg9 __attribute__ ((unused)) = parm9; \ - volatile typeof((parm10)) arg10 __attribute__ ((unused)) = parm9; \ -label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); \ + volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ + volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ + volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ + volatile typeof((parm8)) arg8 __attribute__ ((unused)); \ + volatile typeof((parm9)) arg9 __attribute__ ((unused)); \ + volatile typeof((parm10)) arg10 __attribute__ ((unused)); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ + arg1 = parm1; \ + arg2 = parm2; \ + arg3 = parm3; \ + arg4 = parm4; \ + arg5 = parm5; \ + arg6 = parm6; \ + arg7 = parm7; \ + arg8 = parm8; \ + arg9 = parm9; \ + arg10 = parm10; \ +label: \ + asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); } while (0) #define STAP_PROBE(provider,probe) \ STAP_PROBE_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER)) -- cgit From 68b7cb6fdb08707ae48c8f558278eee3b2ae5154 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 9 Mar 2009 10:40:08 +0100 Subject: Include sys/types.h in sdt.h for __uint64_t. * includes/sys/sdt.h: Add #include . --- includes/sys/sdt.h | 1 + 1 file changed, 1 insertion(+) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index 4eb54250..ba927093 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -11,6 +11,7 @@ #define _SYS_SDT_H 1 #include +#include #if _LP64 #define STAP_PROBE_STRUCT_ARG(arg) \ -- cgit From d82227a838a0ac11827a4047dc33b9e38eefc3b7 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Mon, 9 Mar 2009 21:27:30 -0400 Subject: Use alternate keywords for sdt.h * include/sys/sdt.h: Initialize args when declaring. Use alternate keywords. --- includes/sys/sdt.h | 228 +++++++++++++++++++++-------------------------------- 1 file changed, 92 insertions(+), 136 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index ba927093..ea1da719 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -18,7 +18,7 @@ __uint64_t arg #else #define STAP_PROBE_STRUCT_ARG(arg) \ - long arg __attribute__ ((aligned(8))) + long arg __attribute__ ((aligned(8))) #endif #define STAP_SENTINEL 0x31425250 @@ -33,12 +33,12 @@ struct _probe_ ## probe \ static char probe ## _ ## probe_name [strlen(#probe)+1] \ __attribute__ ((section (".probes"))) \ = #probe; \ -static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,(size_t)& probe ## _ ## probe_name[0],argc}; +__extension__ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,(size_t)& probe ## _ ## probe_name[0],argc}; /* The goto _probe_ prevents the label from "drifting" */ #define STAP_LABEL_REF(probe, label) \ if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto label + goto label; /* These baroque macros are used to create a unique label */ #define STAP_CONCAT(a,b) a ## b @@ -53,190 +53,146 @@ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section #define STAP_PROBE_(probe,label) \ do { \ -label: \ - asm volatile ("nop"); \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label);} while (0) + STAP_LABEL_REF(probe,label); \ +label: \ + __asm__ volatile ("nop");} \ + while (0) #define STAP_PROBE1_(probe,label,parm1) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop /* %0 */" :: "X"( arg1)); } while (0) + __asm__ volatile ("nop /* %0 */" :: "X"( arg1));} \ +while (0) #define STAP_PROBE2_(probe,label,parm1,parm2) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop /* %0 %1 */" :: "X"(arg1), "X"(arg2)); } while (0) + __asm__ volatile ("nop /* %0 %1 */" :: "X"(arg1), "X"(arg2)); \ +} while (0) #define STAP_PROBE3_(probe,label,parm1,parm2,parm3) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop /* %0 %1 %2 */" :: "X"(arg1), "X"(arg2), "X"(arg3)); } while (0) + __asm__ volatile ("nop /* %0 %1 %2 */" :: "X"(arg1), "X"(arg2), "X"(arg3)); \ +} while (0) #define STAP_PROBE4_(probe,label,parm1,parm2,parm3,parm4) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop /* %0 %1 %2 %3 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4)); } while (0) + __asm__ volatile ("nop /* %0 %1 %2 %3 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4)); \ +} while (0) #define STAP_PROBE5_(probe,label,parm1,parm2,parm3,parm4,parm5) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ - arg5 = parm5; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop /* %0 %1 %2 %3 %4 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5)); } while (0) + __asm__ volatile ("nop /* %0 %1 %2 %3 %4 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5)); \ +} while (0) #define STAP_PROBE6_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ + volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ - arg5 = parm5; \ - arg6 = parm6; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6)); } while (0) + __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6)); \ +} while (0) #define STAP_PROBE7_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ + volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ + volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ - arg5 = parm5; \ - arg6 = parm6; \ - arg7 = parm7; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7)); } while (0) + __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7)); \ +} while (0) #define STAP_PROBE8_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ - volatile typeof((parm8)) arg8 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ + volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ + volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ + volatile __typeof__((parm8)) arg8 __attribute__ ((unused)) = parm8; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ - arg5 = parm5; \ - arg6 = parm6; \ - arg7 = parm7; \ - arg8 = parm8; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8)); } while (0) + __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8)); \ +} while (0) #define STAP_PROBE9_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ - volatile typeof((parm8)) arg8 __attribute__ ((unused)); \ - volatile typeof((parm9)) arg9 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ + volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ + volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ + volatile __typeof__((parm8)) arg8 __attribute__ ((unused)) = parm8; \ + volatile __typeof__((parm9)) arg9 __attribute__ ((unused)) = parm9; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ - arg5 = parm5; \ - arg6 = parm6; \ - arg7 = parm7; \ - arg8 = parm8; \ - arg9 = parm9; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9)); } while (0) + __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9)); \ +} while (0) #define STAP_PROBE10_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ do { \ - volatile typeof((parm1)) arg1 __attribute__ ((unused)); \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)); \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)); \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)); \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)); \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)); \ - volatile typeof((parm7)) arg7 __attribute__ ((unused)); \ - volatile typeof((parm8)) arg8 __attribute__ ((unused)); \ - volatile typeof((parm9)) arg9 __attribute__ ((unused)); \ - volatile typeof((parm10)) arg10 __attribute__ ((unused)); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ + volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ + volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ + volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ + volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ + volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ + volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ + volatile __typeof__((parm8)) arg8 __attribute__ ((unused)) = parm8; \ + volatile __typeof__((parm9)) arg9 __attribute__ ((unused)) = parm9; \ + volatile __typeof__((parm10)) arg10 __attribute__ ((unused)) = parm10; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ - arg1 = parm1; \ - arg2 = parm2; \ - arg3 = parm3; \ - arg4 = parm4; \ - arg5 = parm5; \ - arg6 = parm6; \ - arg7 = parm7; \ - arg8 = parm8; \ - arg9 = parm9; \ - arg10 = parm10; \ + STAP_LABEL_REF(probe,label); \ label: \ - asm volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); } while (0) + __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); \ +} while (0) #define STAP_PROBE(provider,probe) \ STAP_PROBE_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER)) -- cgit From 95635ee8a429033dcb5d63727f0f2cae039a2dfd Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Tue, 10 Mar 2009 17:43:17 -0400 Subject: Ensure args are available for postgres static probes. * includes/sys/sdt.h: Couple asm with its arg declaration. --- includes/sys/sdt.h | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index ea1da719..dc2950f0 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -30,7 +30,7 @@ struct _probe_ ## probe \ STAP_PROBE_STRUCT_ARG (probe_name); \ STAP_PROBE_STRUCT_ARG (probe_arg); \ }; \ -static char probe ## _ ## probe_name [strlen(#probe)+1] \ +static char probe ## _ ## probe_name [] \ __attribute__ ((section (".probes"))) \ = #probe; \ __extension__ static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,(size_t)& probe ## _ ## probe_name[0],argc}; @@ -56,80 +56,81 @@ do { \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ STAP_LABEL_REF(probe,label); \ label: \ - __asm__ volatile ("nop");} \ - while (0) + __asm__ volatile ("nop"); \ + } while (0) #define STAP_PROBE1_(probe,label,parm1) \ do { \ - volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ + volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ label: \ - __asm__ volatile ("nop /* %0 */" :: "X"( arg1));} \ -while (0) + __asm__ volatile ("nop /* %0 */" :: "X"( arg1)); \ + STAP_LABEL_REF(probe,label); \ + } while (0) #define STAP_PROBE2_(probe,label,parm1,parm2) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop /* %0 %1 */" :: "X"(arg1), "X"(arg2)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE3_(probe,label,parm1,parm2,parm3) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop /* %0 %1 %2 */" :: "X"(arg1), "X"(arg2), "X"(arg3)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE4_(probe,label,parm1,parm2,parm3,parm4) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop /* %0 %1 %2 %3 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE5_(probe,label,parm1,parm2,parm3,parm4,parm5) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop /* %0 %1 %2 %3 %4 */" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE6_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ volatile __typeof__((parm4)) arg4 __attribute__ ((unused)) = parm4; \ volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE7_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -137,14 +138,14 @@ do { \ volatile __typeof__((parm5)) arg5 __attribute__ ((unused)) = parm5; \ volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE8_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -153,14 +154,14 @@ do { \ volatile __typeof__((parm6)) arg6 __attribute__ ((unused)) = parm6; \ volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ volatile __typeof__((parm8)) arg8 __attribute__ ((unused)) = parm8; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE9_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -170,14 +171,14 @@ do { \ volatile __typeof__((parm7)) arg7 __attribute__ ((unused)) = parm7; \ volatile __typeof__((parm8)) arg8 __attribute__ ((unused)) = parm8; \ volatile __typeof__((parm9)) arg9 __attribute__ ((unused)) = parm9; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE10_(probe,label,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ do { \ + STAP_PROBE_STRUCT(probe,(size_t)&& label) \ volatile __typeof__((parm1)) arg1 __attribute__ ((unused)) = parm1; \ volatile __typeof__((parm2)) arg2 __attribute__ ((unused)) = parm2; \ volatile __typeof__((parm3)) arg3 __attribute__ ((unused)) = parm3; \ @@ -188,10 +189,9 @@ do { \ volatile __typeof__((parm8)) arg8 __attribute__ ((unused)) = parm8; \ volatile __typeof__((parm9)) arg9 __attribute__ ((unused)) = parm9; \ volatile __typeof__((parm10)) arg10 __attribute__ ((unused)) = parm10; \ - STAP_PROBE_STRUCT(probe,(size_t)&& label) \ - STAP_LABEL_REF(probe,label); \ label: \ __asm__ volatile ("nop" :: "X"(arg1), "X"(arg2), "X"(arg3), "X"(arg4), "X"(arg5), "X"(arg6), "X"(arg7), "X"(arg8), "X"(arg9), "X"(arg10)); \ + STAP_LABEL_REF(probe,label); \ } while (0) #define STAP_PROBE(provider,probe) \ -- cgit From ec80b3969d33e4d54e97ead4286bdb018e2f1f97 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 11 Mar 2009 22:11:09 -0400 Subject: improve sdt.h compatibility and test suite Replaced cpp VA_ARGS in sdt.h with explicit enumeration of arguments (since with -pedantic, cpp has no varargs), and added a few more cflags variants to the sdt.exp test case. --- includes/sys/sdt.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'includes/sys/sdt.h') diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index dc2950f0..d6c90192 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -196,26 +196,26 @@ label: \ #define STAP_PROBE(provider,probe) \ STAP_PROBE_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER)) -#define STAP_PROBE1(provider,probe,...) \ - STAP_PROBE1_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE2(provider,probe,...) \ - STAP_PROBE2_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE3(provider,probe,...) \ - STAP_PROBE3_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE4(provider,probe,...) \ - STAP_PROBE4_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE5(provider,probe,...) \ - STAP_PROBE5_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE6(provider,probe,...) \ - STAP_PROBE6_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE7(provider,probe,...) \ - STAP_PROBE7_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE8(provider,probe,...) \ - STAP_PROBE8_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE9(provider,probe,...) \ - STAP_PROBE9_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) -#define STAP_PROBE10(provider,probe,...) \ - STAP_PROBE10_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),__VA_ARGS__) +#define STAP_PROBE1(provider,probe,parm1) \ + STAP_PROBE1_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1)) +#define STAP_PROBE2(provider,probe,parm1,parm2) \ + STAP_PROBE2_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2)) +#define STAP_PROBE3(provider,probe,parm1,parm2,parm3) \ + STAP_PROBE3_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3)) +#define STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ + STAP_PROBE4_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4)) +#define STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ + STAP_PROBE5_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4),(parm5)) +#define STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ + STAP_PROBE6_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4),(parm5),(parm6)) +#define STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ + STAP_PROBE7_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4),(parm5),(parm6),(parm7)) +#define STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ + STAP_PROBE8_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4),(parm5),(parm6),(parm7),(parm8)) +#define STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ + STAP_PROBE9_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4),(parm5),(parm6),(parm7),(parm8),(parm9)) +#define STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ + STAP_PROBE10_(probe,STAP_LABEL(STAP_LABEL_PREFIX(probe),STAP_COUNTER),(parm1),(parm2),(parm3),(parm4),(parm5),(parm6),(parm7),(parm8),(parm9),(parm10)) #define DTRACE_PROBE(provider,probe) \ STAP_PROBE(provider,probe) -- cgit