Hello,

I have a fortran program and want to monitor entry/return events of a specific 
function. No big thing (I thought). The function is called DCNTRL in the source 
code. Checking the binary gives:

 > nm myprog | grep FUNC | grep -i DCNTRL
 [15968] |       6564704|       30193|FUNC |GLOB |0    |12     |dcntrl_

OK, its internal name is dcntrl_. Let's instrument the respective pid 
entry/return probes:

 > dtrace -n 'pid$target::dcntrl_:entry' -n 'pid$target::dcntrl_:return' -c 
 > myprog 
 dtrace: invalid probe specifier pid$target::dcntrl_:return: probe description 
pid17186::dcntrl_:return does not match any probes

Huh, DTrace does not find the return probe!? But I'm sure the function exist, 
so let's put some pressure on DTrace (-Z):

 > dtrace -Z -n 'pid$target::dcntrl_:entry' -n 'pid$target::dcntrl_:return' -c 
 > myprog 
 dtrace: description 'pid$target::dcntrl*:entry' matched 1 probe
 dtrace: description 'pid$target::dcntrl*:return' matched 0 probes

First question: How comes DTrace can instrument the entry probe, but not the 
return probe of that function?

Now let's count events a the instrumented probes:

 > dtrace -Z -n 'pid$target::dcntrl_:entry 
 > {...@f[probefunc,probename]=count()}' -n 'pid$target::dcntrl_:return 
 > {...@f[probefunc,probename]=count()}' -c myprog

  dcntrl_                               entry                                   
     1

Hm, seems like that function was only called once. Fact is, it was called a 
couple of times (verified), but the probe seems only to fire the first time.

I conclude that I'm unable to both instrument and observe the function. Does 
anyone have an idea, how I could proceed?

Thanks for your help, Manfred

PS: I explicitly switched inlining off for that function. (-inline=no%dcntrl). 
Just for reference, I attach the first and last lines of the function:

> mdb myprog
> dcntrl_::dis
dcntrl_:                        pushq  %rbp
dcntrl_+1:                      movq   %rsp,%rbp
dcntrl_+4:                      pushq  %rbx
dcntrl_+5:                      pushq  %r12
dcntrl_+7:                      pushq  %r13
dcntrl_+9:                      pushq  %r14
dcntrl_+0xb:                    pushq  %r15
[..]
dcntrl_+0x75e6:                 popq   %r15
dcntrl_+0x75e8:                 popq   %r14
dcntrl_+0x75ea:                 popq   %r13
dcntrl_+0x75ec:                 popq   %r12
dcntrl_+0x75ee:                 popq   %rbx
dcntrl_+0x75ef:                 leave
dcntrl_+0x75f0:                 ret
-- 
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to