1 Star2 Stars3 Stars4 Stars5 Stars (还没有评分)
Loading...

DTrace tricks and tips (12) –指定程序链接库作为module的命名规则

有时,我们需要使用DTrace追踪程序的链接库的函数,这时module名字就应该是链接库的名字。什么样的名字是有效的呢?让我做个实验验证一下。

我的程序链接了MySQLclient库,执行下面这些命令:

bash-3.2# dtrace -n 'pid$target::mysql_real_connect:entry' -p 10848
dtrace: description 'pid$target::mysql_real_connect:entry' matched 1 probe
^C

bash-3.2# dtrace -n 'pid$target:mysqlclient_r:mysql_real_connect:entry' -p 10848
dtrace: invalid probe specifier pid$target:mysqlclient_r:mysql_real_connect:entry: probe description pid10848:mysqlclient_r:mysql_real_connect:entry does not match any probes

bash-3.2# dtrace -n 'pid$target:libmysqlclient_r:mysql_real_connect:entry' -p 10848
dtrace: description 'pid$target:libmysqlclient_r:mysql_real_connect:entry' matched 1 probe
^C

bash-3.2# dtrace -n 'pid$target:libmysqlclient_r.so:mysql_real_connect:entry' -p 10848
dtrace: description 'pid$target:libmysqlclient_r.so:mysql_real_connect:entry' matched 1 probe
^C

bash-3.2# dtrace -n 'pid$target:libmysqlclient_r.so.15:mysql_real_connect:entry' -p 10848
dtrace: description 'pid$target:libmysqlclient_r.so.15:mysql_real_connect:entry' matched 1 probe
^C

bash-3.2# dtrace -n 'pid$target:libmysqlclient_r.so.15.0:mysql_real_connect:entry' -p 10848
dtrace: description 'pid$target:libmysqlclient_r.so.15.0:mysql_real_connect:entry' matched 1 probe
^C

bash-3.2# dtrace -n 'pid$target:libmysqlclient_r.so.15.0.0:mysql_real_connect:entry' -p 10848
dtrace: description 'pid$target:libmysqlclient_r.so.15.0.0:mysql_real_connect:entry' matched 1 probe
^C

可以看到,libmysqlclient_rlibmysqlclient_r.solibmysqlclient_r.so.15libmysqlclient_r.so.15.0libmysqlclient_r.so.15.0.0都是有效的module名称,但是mysqlclient_r不行。此外省略module名也可以。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.