On Fri, Oct 26, 2007 at 04:51:44PM -0500, Robert Lor wrote:
We're not using 'dtrace -h' now, so I'm not following how the 'dtrace -G..."
step can be removed. Maybe I'm missing something!
Ah. I thought that Apple might have added <sys/dtrace.h> and kept the output
of 'dtrace -h' compatible with the macros. In fact, they've done something
sort of clever. The generated header file contains a slightly different
reference to the private symbol names; Apple them must have modified their
compiler or linker to do the work of 'dtrace -G'.
I say sort of clever because the probes themselves contain the stability
information whereas we use 'dtrace -G' to transmit the stability into the
final DOF object. I've included an example here for the probe foo*:::bar.
Note that is-enabled probes don't have the stability magic so I'm not sure
how things would work if only is-enabled probes were used.
---8<---
/*
* Generated by dtrace(1M).
*/
#ifndef _PROV_H
#define _PROV_H
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FOO_STABILITY "___dtrace_stability$foo$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
#define FOO_TYPEDEFS "___dtrace_typedefs$foo$v1"
#define FOO_BAR() \
{ \
__asm__ volatile(".reference " FOO_TYPEDEFS); \
__dtrace_probe$foo$bar$v1(); \
__asm__ volatile(".reference " FOO_STABILITY); \
}
#define FOO_BAR_ENABLED() \
__dtrace_isenabled$foo$bar$v1()
extern void __dtrace_probe$foo$bar$v1(void);
extern int __dtrace_isenabled$foo$bar$v1(void);
#ifdef __cplusplus
}
#endif
#endif /* _PROV_H */
--->8---
To all USDT developers: you should definitely start using 'dtrace -h'
To Apple: you should make dtrace -G a no-op so that said developers don't
have to change their Makefiles
Adam