dtrace: use pid provider on multiple libraries simultaneously

时间:2015-07-28 15:41:35

标签: dtrace

This dtrace script will fire every time any function is called in libx by process 12345.

dtrace -q -n 'pid12345:libx::entry { printf("probe fired"); }'

But what I really want is to detect function calls in several libraries, say libx, liby, and libz... something like:

dtrace -q -n 'pid12345:libx,liby,libz::entry { printf("probe fired"); }'

Does anyone know if this is possible using the pid provider - or any other provider?

Thanks!

2 个答案:

答案 0 :(得分:0)

I think I found the answer to my own question, but would welcome any other suggestions. The solution I found is to add multiple comma-separated probes:

dtrace -q -n 'pid12345:libx::entry, pid12345:liby::entry, pid12345:libz::entry { printf("probe fired"); }'

答案 1 :(得分:0)

您可以在探测器描述中使用globbing,例如

dtrace -q -n 'pid12345:lib[xyz].so::entry { printf("probe fired"); }'