Hi Alfred,
This is a bug in DTrace. The problem is that dtrace(1M) creates a breakpoint
at the start of main() and that prevents the pid provider from properly
instrumenting main:entry. It should be relatively easy to fix. If you''d
like
to file a bug, that would be great; otherwise I''ll be happy to do it.
Adam
On Thu, Mar 15, 2007 at 08:44:34PM +0800, Alfred Peng
wrote:> Hi guys,
>
> I''ve got a question about pid provider. Attachments are the
test
> case for that.
>
> % cc test.c
> % dtrace -s main.d -c ./a.out
> dtrace: script ''main.d'' matched 3 probes
> Hello, world.
> dtrace: pid 1982 has exited
> CPU ID FUNCTION:NAME
> 1 69948 main:return exit.
>
> From the output, the probe "pid$target:a.out:main:entry"
didn''t
> fire. I''m using Solaris Nevada snv_56 X86. For Solaris 10u2 SPARC,
the
> probe did fire in this case. Anything suggestions?
>
> Thanks,
> -Alfred
>
> #!/usr/sbin/dtrace -s
>
> pid$target:a.out:main:entry
> {
> started = 1;
> printf("Enter into main.");
> }
>
> pid$target:a.out:main:return
> /started == 1/
> {
> printf("Return from main.");
> }
>
> pid$target:a.out:main:return
> {
> printf("exit.");
> exit(0);
> }
>
> int main()
> {
> printf("Hello, world.\n");
> return 0;
> }
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
--
Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl