• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: DTrace and C++ function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DTrace and C++ function


  • Subject: Re: DTrace and C++ function
  • From: Dmitry Markman <email@hidden>
  • Date: Fri, 21 Dec 2007 22:02:36 -0500

Oh, well

I should use *test_cpp*
Terry mentioned regular expression, so I thought I have to use .*test_cpp.*
but that didn'r work
thanks



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:

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>/).

-- Terry

On Dec 21, 2007, at 7:14 AM, Dmitry Markman wrote:
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      (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

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


  • Follow-Ups:
    • Re: DTrace and C++ function
      • From: Eric Gouriou <email@hidden>
References: 
 >DTrace and C++ function (From: Dmitry Markman <email@hidden>)
 >Re: DTrace and C++ function (From: Terry Lambert <email@hidden>)
 >Re: DTrace and C++ function (From: Dmitry Markman <email@hidden>)

  • Prev by Date: Re: DTrace and C++ function
  • Next by Date: Re: Configure and multiple OS X archs
  • Previous by thread: Re: DTrace and C++ function
  • Next by thread: Re: DTrace and C++ function
  • Index(es):
    • Date
    • Thread