Hi, > I've read the example code in /usr/demo/dtrace and the "DTrace user > guide". I can write simple D scripts which use :::entry and :::return > but cannot figure out how to peek into a function that has already begun > executing. This function would typically be a few levels down the stack > and the app is multi-threaded.
I'm afraid your question is not good enough to give good enough answer ;) My understanding is that you want to know how to place probe into random position inside function, not just :::begin and :::end. Are you talking about userland or kernel? If you are talking about kernel _fbt_ provider, it gives you fbt:::entry and fbt:::return, which corresponds to first and last instruction in the function (the last function is not very exact as there may be several returns in the code). If you are talking about userland, the _pid_ provider, it gives you access to nearly every instruction in the code. For example, listing every assembly instruction in the grep(1), function 'succeed', you may do $ dtrace -l -n 'pid$target:grep:succeed:' -c grep | head ID PROVIDER MODULE FUNCTION NAME 73886 pid5865 grep succeed return 73887 pid5865 grep succeed entry 73888 pid5865 grep succeed 0 73889 pid5865 grep succeed 1 73890 pid5865 grep succeed 3 73891 pid5865 grep succeed 6 73892 pid5865 grep succeed a 73893 pid5865 grep succeed c 73894 pid5865 grep succeed 13 ... So if you know where to place the probe, you may use $ dtrace -n 'pid$target:grep:succeed:13' There is another option, called static probes. http://docs.sun.com/app/docs/doc/817-6223/chp-usdt?a=view This lets you to create placeholder for possible named probes at arbitrary places. But if you want to create new one, you have to recompile the module/application. I hope I answered you question. If not, sorry :) -- Vlad
pgpni3uOR0f4i.pgp
Description: PGP signature
_______________________________________________ dtrace-discuss mailing list [email protected]
