Re: DTrace and C++ function
Re: DTrace and C++ function
- Subject: Re: DTrace and C++ function
- From: Dmitry Markman <email@hidden>
- Date: Wed, 26 Dec 2007 22:25:40 -0500
Hi, Eric
maybe you already know how to do that
I was able to trace throw and catch
this is an export script from the Instruments
#pragma D option switchrate=10msec
#pragma D option bufsize=15m
#pragma D option stackindent=0
#pragma D option quiet
syscall::getpriority:entry/execname=="Instruments"/ {}
BEGIN{printf("<dtrace_output_begin/>\n %-14d\n480ED714-974A-4432-
AC52-424A43473C53|2C0D976D-1BDB-4420-AE66-44408748B3EA\n",
walltimestamp/1000);}
pid$target:libstdc++.6.dylib:__cxa_throw:entry {
printf("<e> -1 0 %d %-14d\n%s \n</e>\n",tid, walltimestamp/1000,
probefunc);printf("<s>\n");ustack(128);printf("</s>\n");
}
pid$target:libstdc++.6.dylib:__cxa_begin_catch:entry {
printf("<e> -2 0 %d %-14d\n%s \n</e>\n",tid, walltimestamp/1000,
probefunc);printf("<s>\n");ustack(128);printf("</s>\n");
}
hope it will help
On Dec 25, 2007, at 12:57 AM, Dmitry Markman wrote:
it works
but it's not really consistent with Instruments application
I mean that if you have more then 1 instrument
#pragma D option
will affect all instruments, not just instrument where you add
pragma into DATA section
so it would be better if we have that option in the
Instruments.app preferences
thanks
On Dec 24, 2007, at 9:10 PM, Eric Gouriou wrote:
On Dec 22, 2007, at 12:43 PM, Dmitry Markman wrote:
do you know how i can set -xmangled from Instruments application?
Here is an undocumented way.
In the DATA section of a custom DTrace instrument, add:
#pragma D option mangled
This is the equivalent of -xmangled, from within the script. I am
not sure
of the consequences of setting this option on other instruments
that might
be instantiated in the same run.
Eric
On Dec 22, 2007, at 1:59 PM, Eric Gouriou wrote:
On Dec 21, 2007, at 7:02 PM, Dmitry Markman wrote:
I should use *test_cpp*
Terry mentioned regular expression, so I thought I have to
use .*test_cpp.*
but that didn'r work
Indeed DTrace understands glob patterns, not regular expressions.
man dtrace has examples of ObjC probes using such patterns.
The idiomatic way to match :: is to use ??.
I''ll also add that -xmangled was added to switch DTrace to use the
mangled representation instead of the default demangled one. It can
be very useful for C++ work.
This article might also be of interest:
<http://developers.sun.com/solaris/articles/dtrace_cc.html>
Although it looks like the default there is to use mangled names.
Dmitry Markman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Dmitry Markman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden