我在我的应用程序中列出了探针:
sudo dtrace -p "$(pgrep run)" -ln 'pid$target:QtCore:*sendPostedEvents*:entry {}'
ID PROVIDER MODULE FUNCTION NAME
8037 pid53854 QtCore QCoreApplication::sendPostedEvents(QObject*, int) entry
8038 pid53854 QtCore QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) entry我想跟踪函数QCoreApplication::sendPostedEvents(QObject*, int)**.**的条目探针,但是函数名中有一些字符不能在探针说明符中表示。
例如,我不能在不以某种方式转义的情况下输入它(因为冒号在DTrace探针说明符中是有意义的):
sudo dtrace -p "$(pgrep run)" -n 'pid$target:QtCore:QCoreApplication::sendPostedEvents(QObject*, int):entry { ustack(3); }'
dtrace: invalid probe specifier pid$target:QtCore:QCoreApplication::sendPostedEvents(QObject*, int):entry { ustack(3); }: invalid probe description "pid$target:QtCore:QCoreApplication::sendPostedEvents(QObject*": Overspecified probe description我试过用反斜杠,单引号,双引号来逃避。是否可以按名称指定此探测函数?
我不能使用通配符;*sendPostedEvents*与我不想要的QCoreApplicationPrivate::sendPostedEvents匹配。
我怀疑我是否能够依赖探测ID,因为这是PID提供程序(我期望探测ID在随后的代码编译中改变)。
发布于 2017-07-25 02:48:49
您可以使用?通配符来匹配单个字符:
sudo dtrace -p "$(pgrep run)" -n 'pid$target:QtCore:QCoreApplication??sendPostedEvents*:entry { ustack(3); }'问号将与“:”匹配,但不匹配"Private::“。
https://stackoverflow.com/questions/45290559
复制相似问题