Nicolas Williams
2009-Oct-28 18:54 UTC
[dtrace-discuss] where do kernel data types come from?
On Wed, Oct 28, 2009 at 06:55:28PM +0000, Joel Reymont wrote:> I have a script where I can freely reference struct nameidata*, struct > vnode*, etc. on Snow Leopard. > > How does DTrace know about these data types? I understand things like > > #pragma D depends_on library darwin.d > > where darwin.d has typedefs. > > I can''t find definitions of nameidata and vnode in any D scripts, > though. How does it work?On Solaris these come from CTF data embedded in the ELF files that make up the kernel and loadable modules. The CTF data comes from ctfconvert and other build utilities, which in turn get the data from the .os originally output by the compilers. Nico --
I have a script where I can freely reference struct nameidata*, struct vnode*, etc. on Snow Leopard. How does DTrace know about these data types? I understand things like #pragma D depends_on library darwin.d where darwin.d has typedefs. I can''t find definitions of nameidata and vnode in any D scripts, though. How does it work? Thanks, Joel --- firefox for android! http://wagerlabs.com
Same on Mac OS X. In Snow Leopard, the final CTF data is linked into the kernel file. In previous versions of Mac OS X, the CTF data was in a separate "mach_kernel.ctfsys" file $ size -arch x86_64 -l /mach_kernel | grep -A 2 __CTF Segment __CTF: 0 (vmaddr 0x0 fileoff 5320728) Section __ctf: 254545 (addr 0x0 offset 5320728) total 254545 Shantonu Sen ssen at apple.com Sent from my Mac Pro On Oct 28, 2009, at 11:54 AM, Nicolas Williams wrote:> On Wed, Oct 28, 2009 at 06:55:28PM +0000, Joel Reymont wrote: >> I have a script where I can freely reference struct nameidata*, struct >> vnode*, etc. on Snow Leopard. >> >> How does DTrace know about these data types? I understand things like >> >> #pragma D depends_on library darwin.d >> >> where darwin.d has typedefs. >> >> I can''t find definitions of nameidata and vnode in any D scripts, >> though. How does it work? > > On Solaris these come from CTF data embedded in the ELF files that make > up the kernel and loadable modules. The CTF data comes from ctfconvert > and other build utilities, which in turn get the data from the .os > originally output by the compilers. > > Nico > -- > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
On Oct 28, 2009, at 8:00 PM, Shantonu Sen wrote:> Same on Mac OS X. In Snow Leopard, the final CTF data is linked into > the kernel file. In previous versions of Mac OS X, the CTF data was > in a separate "mach_kernel.ctfsys" fileI didn''t know what CTF was but this page provided a good summary: http://blogs.sun.com/levon/entry/reducing_ctf_overhead Thanks, Joel --- firefox for android! http://wagerlabs.com