On Sep 14, 2009, at 9:01 AM, Joel Reymont wrote:
> Does dtrace have a problem catching the return from memset on Mac OSX?
>
> The script below catches the entry just fine but the return clause
> is never entered.
>
> Thanks, Joel
DTrace thinks its seeing a jump table:
sh-3.2# dtrace -xdebug -n ''pid2469::memset:return''
libdtrace DEBUG: library /usr/lib/dtrace/coreprofile.d sorted (1/2)
libdtrace DEBUG: library /usr/lib/dtrace/io.d sorted (4/5)
libdtrace DEBUG: library /usr/lib/dtrace/sched.d sorted (6/7)
libdtrace DEBUG: library /usr/lib/dtrace/darwin.d sorted (3/8)
libdtrace DEBUG: library /usr/lib/dtrace/errno.d sorted (9/10)
libdtrace DEBUG: library /usr/lib/dtrace/regs_x86_64.d sorted (11/12)
libdtrace DEBUG: library /usr/lib/dtrace/signal.d sorted (13/14)
libdtrace DEBUG: library /usr/lib/dtrace/unistd.d sorted (15/16)
libdtrace DEBUG: typedef taskid_t added as id 32797
libdtrace DEBUG: typedef projid_t added as id 32798
libdtrace DEBUG: typedef poolid_t added as id 32799
libdtrace DEBUG: typedef zoneid_t added as id 32800
libdtrace DEBUG: typedef timestruc_t added as id 32804
libdtrace DEBUG: typedef psinfo_t added as id 32823
libdtrace DEBUG: typedef psetid_t added as id 32826
libdtrace DEBUG: typedef lwpsinfo_t added as id 32830
libdtrace DEBUG: type struct _processor_info added as id 32832
libdtrace DEBUG: typedef _processor_info_t added as id 32835
libdtrace DEBUG: typedef chipid_t added as id 32836
libdtrace DEBUG: typedef lgrp_id_t added as id 32837
libdtrace DEBUG: type struct cpuinfo added as id 32838
libdtrace DEBUG: typedef cpuinfo_t added as id 32839
libdtrace DEBUG: typedef bufinfo_t added as id 32846
libdtrace DEBUG: typedef devinfo_t added as id 32849
libdtrace DEBUG: typedef offset_t added as id 32855
libdtrace DEBUG: typedef fileinfo_t added as id 32857
libdtrace DEBUG: pid 2469: kCSNotificationInitialized
libdtrace DEBUG: grabbed pid 2469
libdtrace DEBUG: creating probe pid2469:dyld:memset:return
libdtrace DEBUG: found a suspected jump table at memset:15
libdtrace DEBUG: creating probe pid2469:libSystem.B.dylib:memset:return
libdtrace DEBUG: found a suspected jump table at memset:15
dtrace: invalid probe specifier pid2469::memset:return: probe
description pid2469::memset:return does not match any probes
libdtrace DEBUG: releasing pid 2469
sh-3.2# otool -t -V -arch x86_64 /usr/lib/libSystem.B.dylib
/usr/lib/libSystem.B.dylib:
(__TEXT,__text) section
(...)
_memset:
0000000000001034 andl $0x000000ff,%esi
000000000000103a jne 0x0000104b
000000000000103c movq $0x00007fffffe00600,%rax
0000000000001046 movq %rdx,%rsi
0000000000001049 jmp *%eax
000000000000104b movq %rdi,%r8
Clearly we could be doing better, but that is why dtrace is giving up
on the return probe.
James M