Hey

So, myself & Damian are looking in to adding dtrace to KDE and it's  
support libraries, and it occurred to us that C++ name mangling,  
templates and the likes make probe names difficult. A templated  
function like swap() ends up mangled to something like  
__Z4swapIiEvRT_S1_.

So, because dtrace doesn't auto-demangle names and convincing the  
dtrace people to make it so poses both political and technical  
problems, we figure that it's easier to exploit the fact that you can  
give the probe any name that you like ( for example the fbt provider  
has entry and return probes ).

I came up with this mangling scheme:

[namespace. Required]-[class name, if any]-[function name]-[argument.  
prefixed by T if it's templated, postfixed by p if it's a pointer]- 
[probe name]

so for example:

template <class Arg>
swap ( Arg&, Arg& )

in the global namespace would have fbt-style probes such as:
global-swap-TArg-TArg-entry or global-swap-TArg-TArg-return.


The fully qualified dtrace probe for this would be something like:
libstdcxx::__Z4swapIiEvRT_S1_:global-swap-TArg-TArg-entry

which I find to be a lot nicer than
libstdcxx::__Z4swapIiEvRT_S1_:entry

my proposed way, you can tell a lot of information about where exactly  
the probe is firing. The way we have now you have to run through c+ 
+filt to get any meaningful information out of.

Anyone have any problems/suggestions/objections with this scheme?

cheers

-John

Reply via email to