I want to go a lot deeper with my tracing of MySQL and to do so I want to look into MySQL Thread Descriptors (class THD). Inside is a great bulk of information utilized by a great many of the core functions within MySQL... I really want to get in there. So far I''ve had no luck though. It''s a C++ class, and I''m afraid that I''m approaching it like a C struct, which may be entirely wrong but I have no experience tracing C++ this deeply. I''m curious to know if anyone has tackled this yet. Furthermore, I''m curious if I can peer into THD by writing a translator... given the C++''isms I''m not sure if thats possible or not. The only work to this end that I''ve seen thus far is to embed static probes in the code where a handful of THD members are offered as probe args, but this is problematic given that there are a lot more than 10 things in there that you''d like to see. Anyone taken on THD without the use of static probes? Is it possible? benr. -- This message posted from opensolaris.org
John Levon
2008-Apr-07 12:22 UTC
[dtrace-discuss] Userspace CTF hacks (was Re: MySQL THD via PID Provider)
On Mon, Apr 07, 2008 at 02:36:20AM -0700, Ben Rockwood wrote:> I want to go a lot deeper with my tracing of MySQL and to do so I want > to look into MySQL Thread Descriptors (class THD). Inside is a great > bulk of information utilized by a great many of the core functions > within MySQL... I really want to get in there.I meant to bring this up at the conference but never got around to it. For other, rather prosaic, reasons, I hacked up ''ctftoh'' a while ago. It basically walks the CTF of a given binary and outputs a C .h file. It occurred to me later that this could be used pretty easily for poor man''s userspace CTF with DTrace. You''d just pass in the binary (mysql, say) and include the output in a DTrace script. It''s obviously far away from what we''d really like for userspace CTF (since you still don''t get a direct args[], or auto-copyin, etc.) but I think it''d still be useful for situations like yours. It needs finishing though (fleshing out the parsing a little more, and ordering the output so it will compile). Anyone interested? regards john
John Levon
2008-Apr-07 18:35 UTC
[dtrace-discuss] Userspace CTF hacks (was Re: MySQL THD via PID Provider)
On Mon, Apr 07, 2008 at 11:00:54AM -0700, Ben Rockwood wrote:> Everything helps, sounds really kool. Any chance at getting a look?http://cr.opensolaris.org/~johnlev/ctftoh/ Such as it is. The biggest work left would be the topological sort so that the compiler can understand the header. It''s not too complicated, and I had an algorithm sorted out, but promptly forgot it. I think it was something like "output all typedefs and a bunch of forward declarations, then walk the tree" regards john