John Sonnenschein
2007-Dec-11 20:48 UTC
[dtrace-discuss] DTrace & C++ name mangling, an RFC
Hello, So, as part of the KDE project, I''d like to add dtrace probes to some of the support libraries such as Qt & the version of the C++ standard library we''re shipping ( apache/roguewave ). Unfortunately to support templates, overloading & namespaces C++ requires name mangling in order to work, so a templated function that takes two arguments in the global namespace named ''swap'' will end up being called something like _Z4swapIiEvRT_S1_ , which is utterly meaningless. So, rather than demangling the function name in the USDT probes I want to add, I''m considering exploiting the probe name to do this ( not an ideal scenario, but I can''t think of a better way ). my current idea is to create a probe name scheme that makes some sort of sense, and what I came up with is to name the probe like this: namespace-functionname-[class, if any-]<arg0 type, prefixed with T if it''s a templated type>-<arg1, as before>...-probe so a 2-templated argument function in the global namespace named swap would have probes named global-swap-TT-TT-entry or global-swap-TT-TT-return this unfortunately doesn''t allow you to do things like trace everything in blah::function, but given the alternative ( figuring out the function name that you may not even know because it''s private ) I think it''s a fairly reasonable compromise What I''d like to know is if there''s any other issues that I should be aware of, or if this is just a foolhardy pursuit all over. Thanks for any comments -John -- This message posted from opensolaris.org
John Sonnenschein
2007-Dec-11 20:50 UTC
[dtrace-discuss] DTrace & C++ name mangling, an RFC
seems that the name of the probe was stripped by the website... namespace-functionname-[class, if any-]-...-probe should read namespace-functionname-[class, if any-]-(arg0 type name, prefixed with T if it''s templated)-(arg1 type name, similar)...-probe -- This message posted from opensolaris.org
On Tue, Dec 11, 2007 at 12:48:11PM -0800, John Sonnenschein wrote:> What I''d like to know is if there''s any other issues that I should be aware of, or if this is just a foolhardy pursuit all over.That seems like an entirely reasonable avenue to persue. You may quickly hit the limit of 64 characters for the probe name. If you do, let us know -- we can always raise the limit. Adam -- Adam Leventhal, FishWorks http://blogs.sun.com/ahl