Hi,
     I am using DTrace to analyze Mozilla Firefox. I want to print the ustack, 
args[2] for the following two C++ methods.
--------------------
nsComponentManagerImpl::CreateInstance(const nsCID &aClass,
                                       nsISupports *aDelegate,
                                       const nsIID &aIID,
                                       void **aResult)

nsComponentManagerImpl::CreateInstanceByContractID(const char *aContractID,
                                                   nsISupports *aDelegate,
                                                   const nsIID &aIID,
                                                   void **aResult)

struct nsID {
  /**
   * @name Identifier values
   */

  //@{
  PRUint32 m0;
  PRUint16 m1;
  PRUint16 m2;
  PRUint8 m3[8];
  //@}
.....

typedef nsID nsIID;

-------------------
So, I wrote the probes as follows.

-------------------
pid$target:XUL:__ZN22nsComponentManagerImpl26CreateInstanceByContractIDEPKcP11nsISupportsRK4nsIDPPv:entry
{
    printf ("iid : %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 
args[2].m0, args[2].m1, args[2].m2, args[2].m3[0], args[2].m3[1], 
args[2].m3[2], args[2].m3[3], args[2].m3[4], args[2].m3[5], args[2].m3[6], 
args[2].m3[7]);
    ustack ();
}

pid$target:XUL:__ZN22nsComponentManagerImpl26CreateInstanceByContractIDEPKcP11nsISupportsRK4nsIDPPv:entry
{
    printf ("iid : %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 
args[2].m0, args[2].m1, args[2].m2, args[2].m3[0], args[2].m3[1], 
args[2].m3[2], args[2].m3[3], args[2].m3[4], args[2].m3[5], args[2].m3[6], 
args[2].m3[7]);
    ustack ();
}
~-------------------
I used nm (otool) to get these mangled names.

DTrace complains that these does not match any probes.

So, I changed the probes to *nsComponentManagerImpl*CreateInstance[!B]* and 
*nsComponentManagerImpl*CreateInstanceByContractID*

Now DTrace complains 

dtrace: failed to compile script /Users/sudheer/work/prof/dtrace/compssrvcs.d: 
line 7: args[ ] may not be referenced because probe description 
pid181::*nsComponentManagerImpl*CreateInstance[!B]*:entry matches an unstable 
set of probes


I tried dtrace -l -p <pid of firefox> | grep -i createinstance and I got no 
output.

So, I commented using args[2] but just did ustack(). In that case, DTrace 
output contained only two probeIDs (and two CPU IDs, if that matters). Also, 
the probe IDs differ each time I run the program.

- How can I fix this? 
- Why dtrace -l is not listing these functions? but can produces output with 
probeIDs?
- Is there a way to use these probe IDs in the D script?
- Why the probe IDs differ? Is it something to do with shared libraries?
- Is there a way for me to get the output I want by using arg2? instead of 
args[2]

I will really appreciate your help.


--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to