[issue13405] Add DTrace probes

Marc Abramowitz report at bugs.python.org
Wed Feb 22 08:28:28 CET 2012


Marc Abramowitz <msabramo at gmail.com> added the comment:

Jesús said he was focusing on Solaris and couldn't help with OS X. Not sure if anyone else was going to try tackling that...

Just tried the patch `issue13405_4027.diff` on OS X 10.6.8.

First problem I ran into was:

gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -I. -I./Include    -DPy_BUILD_CORE -o ./Include/phelper_offsets \
		./Include/phelper_offsets.c
./Include/phelper_offsets.c: In function 'main':
./Include/phelper_offsets.c:23: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
./Include/phelper_offsets.c:26: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
./Include/phelper_offsets.c:28: warning: implicit declaration of function 'offsetof'
./Include/phelper_offsets.c:28: error: expected expression before 'PyCompactUnicodeObject'
./Include/phelper_offsets.c:30: error: expected expression before 'PyCompactUnicodeObject'
make: *** [Include/phelper_offsets.h] Error 1

OS X seems to have `offsetof` defined in `stddef.h` -- adding `#include <stddef.h>` got this to compile.

The next problem was with: 

```
if test "dtrace" != "" ; then \
		dtrace -o Python/phelper.o -DPHELPER -64 \
			-I. -I./Include   -C -G -s ./Include/phelper.d ; \
	else	touch Python/phelper.o ; \
	fi;
```

This fails because DTrace on OS X doesn't have the -G option. Removing the `-G` (total hack since it seems like `-G` is not at all a trivial option) results in:

```
dtrace: failed to initialize dtrace: DTrace requires additional privileges
```

Adding `sudo` isn't a practical solution, but I tried it to see if it would help or if there would be other errors and there was another error:

```
dtrace: ignored option -- 64
/dev/fd/5:42:8: warning: undefining "__STDC__"
dtrace: failed to compile script ./Include/phelper.d: "/usr/include/libkern/_OSByteOrder.h", line 98: specified storage class not appropriate in D
make: *** [Python/phelper.o] Error 1
```

----------
nosy: +Marc.Abramowitz

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13405>
_______________________________________


More information about the Python-bugs-list mailing list