G'Day,

The way isenabled probes are compiled on Mac OS X Lion has changed in a way
that dosen't compile (at least, with some compilers).  Here's the test to
try:

$ cat -n liontest.d
     1 provider lion {
     2 probe hello(const char *world);
     3 };
$ dtrace -h -s liontest.d -o liontest.h

On Snow Leopard this output:

$ cat -n liontest.h
[...]
    24 #define LION_HELLO_ENABLED() \
    25 __dtrace_isenabled$lion$hello$v1()

On Lion that is now:

$ can -n liontest.h
[...]
    26 #define LION_HELLO_ENABLED() \
    27        ({ int _r = __dtrace_isenabled$lion$hello$v1(); \
    28                __asm__ volatile(""); \
    29                _r; })

Which doesn't compile when used in if statements (the use case for
isenabled).  Which means, some software that has DTrace probes is now not
compiling on Lion.

Another difference is the addition of:

#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED

but I don't think that is breaking anything.

I've attached both header files from the OS versions.  Does Apple know of
this?

thanks,

Brendan

-- 
Brendan Gregg, Joyent                      http://dtrace.org/blogs/brendan
/*
 * Generated by dtrace(1M).
 */

#ifndef _LIONTEST_H
#define _LIONTEST_H

#include <unistd.h>

#ifdef  __cplusplus
extern "C" {
#endif

#define LION_STABILITY "___dtrace_stability$lion$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"

#define LION_TYPEDEFS "___dtrace_typedefs$lion$v2"

#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED

#define LION_HELLO(arg0) \
do { \
        __asm__ volatile(".reference " LION_TYPEDEFS); \
        __dtrace_probe$lion$hello$v1$63686172202a(arg0); \
        __asm__ volatile(".reference " LION_STABILITY); \
} while (0)
#define LION_HELLO_ENABLED() \
        ({ int _r = __dtrace_isenabled$lion$hello$v1(); \
                __asm__ volatile(""); \
                _r; })


extern void __dtrace_probe$lion$hello$v1$63686172202a(const char *);
extern int __dtrace_isenabled$lion$hello$v1(void);

#else

#define LION_HELLO(arg0) \
do { \
        } while (0)
#define LION_HELLO_ENABLED() (0)

#endif /* !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED */


#ifdef  __cplusplus
}
#endif

#endif  /* _LIONTEST_H */
/*
 * Generated by dtrace(1M).
 */

#ifndef	_LIONTEST_H
#define	_LIONTEST_H

#include <unistd.h>

#ifdef	__cplusplus
extern "C" {
#endif

#define LION_STABILITY "___dtrace_stability$lion$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"

#define LION_TYPEDEFS "___dtrace_typedefs$lion$v2"

#define	LION_HELLO(arg0) \
do { \
	__asm__ volatile(".reference " LION_TYPEDEFS); \
	__dtrace_probe$lion$hello$v1$63686172202a(arg0); \
	__asm__ volatile(".reference " LION_STABILITY); \
} while (0)
#define	LION_HELLO_ENABLED() \
	__dtrace_isenabled$lion$hello$v1()


extern void __dtrace_probe$lion$hello$v1$63686172202a(char *);
extern int __dtrace_isenabled$lion$hello$v1(void);

#ifdef	__cplusplus
}
#endif

#endif	/* _LIONTEST_H */
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to