Re: DTrace and C++ function
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Oh, well On Dec 21, 2007, at 8:10 PM, Dmitry Markman wrote: Hi Terry thanks a lot for your answer but probably I didn't get it right here is what I did I created simple command line tool #include <iostream> #include <unistd.h> using namespace std; extern "C" { void test_c() { cout << "Hello, World! test_cpp" << endl; } } void test_cpp() { test_c(); } int main (int argc, char * const argv[]) { for(int i = 0; i < 100; i++) { sleep(1); test_cpp(); } return 0; } nm returns ....T __Z8test_cppv and ......T _test_c so I created 2 probs one for test_c pid : DTraceCPPFunction : test_c:entry and another for .*test_cpp.* pid : DTraceCPPFunction : .*test_cpp.* : entry but only prob for test_c did work and I can clearly see in the stack trace that test_cpp was called thanks On Dec 21, 2007, at 5:24 PM, Terry Lambert wrote: -- Terry Hi, is it possible to trace C++ function? I was able to create prob for c++ function ::foo_cpp that was called from c function foo_c I created 2 probs one for foo_c and another for ::foo_cpp but I was able to see events only for foo_c prob (and I can see ::foo_cpp in stack) and none for ::foo_cpp prob I think it's wrong, because foo_c is called ONLY from ::foo_cpp Dmitry Markman _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/tlambert%40apple.com Dmitry Markman _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/dmarkman%40mac.com Dmitry Markman _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I should use *test_cpp* Terry mentioned regular expression, so I thought I have to use .*test_cpp.* but that didn'r work thanks You can't use a colon in a name, but you can use a regular expression. You can also add a string compare as one of the constraints on pthe probe firing (in the /<predicate>/). On Dec 21, 2007, at 7:14 AM, Dmitry Markman wrote: This email sent to tlambert@apple.com This email sent to dmarkman@mac.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Dmitry Markman