Hello Rayson,
On Thu, Mar 26, 2009 at 11:09 AM, Rayson Ho <rayrayson at gmail.com>
wrote:> On 3/25/09, Amit Saha <amitsaha.in at gmail.com> wrote:
>> the ''DTRACE_PROBE*'' macros are defined for #ifndef
_KERNEL and
>> otherwise. Is it to ensure the availability of the macros to both user
>> and kernel space code ?
>
> That''s the basic idea, SDT probes can be placed in kernel and user
code.
>
> And one small difference is that in the kernel there is no provider,
> so you may notice that the "provider" parameter missing.
>
> And while we are on this topic, the sys/sdt.h include file is not
> magic. All those macros in the source defined by the programmer get
> expanded during the pro-process step in the compilation process into:
>
> 1) a function prototype, and
> 2) a real call
>
> And if you read the assembly listing of the function that has a SDT
> probe, you will see a call with the name "__dtrace_<provider
> name>_<name>"
>
> The real magic is in the dtrace command, which then finds all those
> calls with the special name and marks them as "IGNORE", so that
the
> static linker won''t complain about the missing function definition
> when linking the application.
>
> Finally, when the application is loaded during execution, the dynamic
> linker gets those "function calls" information. Knowing that
those are
> SDT probes, it may either patch the call instruction as NOP, or make
> them as real probes if enabled.
Thanks for the explanations. Much appreciated.>
> In theory, even without sdt.h you can do whatever you want to the
> function names and still get a working SDT probe, as long as dtrace -G
> knows that those are SDT probes and mark the probes (the function call
> to nowhere) correctly.
I am guessing that hat you are referring to would be the things that
are made possible by using the auto generated custom probes via the
''-h'' switch ?
-Amit>
> Rayson
>
>
>>
>>
>> Thanks,
>> Amit
>>
>> --
>> http://amitksaha.blogspot.com
>> http://amitsaha.in.googlepages.com/
>> *Bangalore Open Java Users Group*:http:www.bojug.in
>>
>> "Recursion is the basic iteration mechanism in Scheme"
>> --- http://c2.com/cgi/wiki?TailRecursion
>> _______________________________________________
>> dtrace-discuss mailing list
>> dtrace-discuss at opensolaris.org
>>
>
--
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in
"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion