I had a situation like this: namespace my { void f() { DTRACE_PROBE(my, f_probe); } }
After postprocessing with dtrace -G as shown in the manual, I get linker errors showing undefined symbols of mangled C++ names. Looking into sys/sdt.h, it turns out that the function declaration in the macro gets name-mangled. So I made a separate .h file that will override linkage to C linkage, something like: #define PROBELINK(name) extern void __dtrace_perun___##name(...) extern "C" { PROBELINK(f_probe); // other probes } which gets included on top of every file. I also copied the system sys/sdt.h to working directory and edited it by erasing extern declarations in DTRACE_PROBE macros. [incidentally, extern "C" is allowed only on top-level declarations in C++... strange.] Now, the program links w/o errors, but the final executable does not include any __dtrace_* symbols related to my probe points (checked by nm + grep). Trying to dtrace with the sdt provider reports that there are no probes by the defined name, here's an example script: my$target:::f_probe { } Has anyone managed to use the SDT provider from within C++ program? If so, I'd be grateful for any guidance. [PS: sorry for miserable grammar, I'm writing this in a hurry...] This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code