dtrace

Why does DTrace give me invalid-address errors sometimes but not always?

我与影子孤独终老i 提交于 2019-12-13 11:34:37
问题 My program: typedef struct objc_class { struct objc_class *isa; struct objc_class *super_class; char *name; long version; long info; long instance_size; void *ivars; void *methodLists; void *cache; void *protocols; } *Class; struct objc_object { Class isa; }; /* Code to extract the class name from arg0 based on a snippet by Bill Bumgarner: http://friday.com/bbum/2008/01/26/objective-c-printing-class-name-from-dtrace/ */ objc$target:NSObject:-init:entry { printf("time: %llu\n", timestamp);

Is it possible to notify DTrace on Mac OS X of dynamically generated code?

有些话、适合烂在心里 提交于 2019-12-12 13:17:45
问题 We would like to extend Mono's VM to generate information that can be consumed by DTrace and instruments. I am looking at making changes to the Mono runtime to have it register or notify the code that it has dynamically generated so DTrace can produce useful information for those blocks of code. 回答1: What kind of information do you want to include? The main example of doing this is ustack helpers, which convey from a VM to DTrace how to translate stack frames into human-readable frames. These

automated assembly loop level profiling

和自甴很熟 提交于 2019-12-12 09:01:48
问题 Does anyone know any assembly loop level profiler? I have been using gprof but gprof hides loops and it is function level profiling, yet to optimize my code i want something to go to the loop level. I want it to be automated and just give me the output like gprof. I was recommended to go to dtrace yet I have no idea were to start. anyone can direct me in anyway? for example main: pushl %ebp movl %esp, %ebp subl $16, %esp movl $5000000, -4(%ebp) movl $0, -12(%ebp) movl $0, -8(%ebp) jmp .L2 .L3

How do I print a CFStringRef in a DTrace action?

五迷三道 提交于 2019-12-12 07:53:33
问题 I have a DTrace probe catching calls to a function, and one of the function's arguments is a CFStringRef . This is private structure that holds a pointer to a unicode string. But the CFStringRef is not itself a char* , so normal DTrace methods like copyinstr() just return ?cp? , which isn't exactly helpful. So how can I print out the string in the DTrace action? 回答1: As far as I know, there is not built-in support for this kind of thing. Usually a library would publish a probe that decodes

Dtrace invalid address error when extracting process command line

女生的网名这么多〃 提交于 2019-12-12 04:17:09
问题 I'd like to have dtrace script that print new processes' cmdline and their matching parent name. i.e. : if I ran /Users/bla/myexec arg1 arg2 arg3 from bash I will get something like : parent is bash process is --> /Users/bla/myexec arg1 arg2 arg3 After searching here and here I came up with the following solution : #!/usr/sbin/dtrace -s proc:::exec { self->pexecname = execname; } proc:::exec-success / self->pexecname != 0 / { this->isx64=(curproc->p_flag & P_LP64)!=0; #define SELECT_64_86(x64

Locating file descriptor leak in OS X application

旧城冷巷雨未停 提交于 2019-12-11 06:06:48
问题 Background I have some very complex application. It is composition of couple libraries. Now QA team found the some problem (something reports an error). Fromm logs I can see that application is leaking a file descriptors (+1000 after 7 hours of automated tests). QA team has delivered rapport "opened files and ports" from "Activity monitor" and I know exactly to which server connection is not closed. From full application logs I can see that leak is quite systematic (there is no sudden burst),

Detecting redundant function calls within call stack tree with DTrace

泄露秘密 提交于 2019-12-11 05:57:35
问题 I'm having a hard time tracking down unnecessary redundant calls within a rather complex algorithm. It looks like (some of my) my algorithm(s) is/are seriously slowed down by redundant calls (in several subroutines) of a non-cached and comparatively expensive function. To confirm this I'd like to utilize Dtrace to detect multiple calls of a single function within a given branch of the call stack tree. I'd like to be able to ask dtrace to: search the call stack tree within a given function

Local Variables in Dtrace

感情迁移 提交于 2019-12-11 03:39:21
问题 How do I access variables local to a function using dtrace? For example, in the following snippet I would like to know the value of variable x using dtrace. void foo(int a){ int x=some_fun(a); } 回答1: Tracing local variables is impossible for kernel code because there is no mechanism to instrument arbitrary kernel instructions. Even in user-land, tracing local variables is somewhat convoluted and so, for the specific example you give, it would make a lot more sense to trace the return value of

Node.js dtrace error in Mac OS X Yosemite

假装没事ソ 提交于 2019-12-11 02:13:00
问题 I try DTrace the Node.js application on the Mac OS X 10.10 Yosemite: sudo dtrace -n 'profile-97/execname == "node" && arg1/{ @[jstack(150, 8000)] = count(); } tick-60s { exit(0); }' &> /tmp/dtrace.out And this is what I have: http://pastebin.com/NjbR2zug There are an errors like this: dtrace: error on enabled probe ID 1 (ID 28: profile:::profile-97): invalid address (0x5) in action #2 Node.js installed both by a Brew and a NVM, I tried launch my app.js by both this installations. What can I

Can DTrace find non-extractable private key from Keychain on OS X?

£可爱£侵袭症+ 提交于 2019-12-11 00:07:51
问题 I'm trying to get a hold of a private key that doesn't seem to be exportable from Keychain Access.app directly on OS X, probably because it was imported with the option to make it non-extractable. What I think might work is trying to intercept the said private key when it's used by the VPN software, the web-browser or some system software for the actual PKI authentication; is there a way to do this, perhaps with DTrace? 来源: https://stackoverflow.com/questions/25044418/can-dtrace-find-non