• 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 Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DTrace Questions


  • Subject: Re: DTrace Questions
  • From: Eric Gorr <email@hidden>
  • Date: Fri, 7 May 2010 10:31:47 -0400


On May 6, 2010, at 5:50 PM, Franklin Marmon wrote:


This may not be what you are looking for, but it prints entry points for all my application's functions.

sudo dtrace -n 'pid[MYPID]:[APPNAME]::entry { printf( "%s", execname ) }'

replacing [MYPID] and [APPNAME] as appropriate for your target application. Obviously the same thing is possible for return functions too.


As another test, I created the default Cocoa Application and wrote this:

- (void) myRandomMethod
{
int x, y;


y = 1;


for ( x = 0; x < 9000000; x++ )
{
y++;
}
}

- (void) applicationDidFinishLaunching:(NSNotification *)aNotification 
{
[self myRandomMethod];

}



I then build and ran the debug version and executed:

~ $sudo dtrace -n 'pid653:MyApp::entry { printf( "%s", execname ) }'
dtrace: description 'pid653:MyApp::entry ' matched 7 probes

However, it does not seem to be listing any entry or exit probe for myRandomMethod. What the 7 probes it did match, I am not sure as it just seemed to hang after printing out that it matched 7 probes.

What did seem to work was doing:

~ $sudo dtrace -l -n 'pid1005:MyApp::entry'
   ID   PROVIDER            MODULE                          FUNCTION NAME
26632    pid1005             MyApp                             start entry
361570    pid1005             MyApp                              main entry
361588    pid1005             MyApp -[MyAppAppDelegate myRandomMethod] entry
361609    pid1005             MyApp -[MyAppAppDelegate applicationDidFinishLaunching:] entry
361628    pid1005             MyApp        -[MyAppAppDelegate window] entry
361647    pid1005             MyApp    -[MyAppAppDelegate setWindow:] entry
361668    pid1005             MyApp                      stub helpers entry
~ $sudo dtrace -l -n 'pid1005:MyApp::return'
   ID   PROVIDER            MODULE                          FUNCTION NAME
361569    pid1005             MyApp                              main return
361587    pid1005             MyApp -[MyAppAppDelegate myRandomMethod] return
361608    pid1005             MyApp -[MyAppAppDelegate applicationDidFinishLaunching:] return
361627    pid1005             MyApp        -[MyAppAppDelegate window] return
361646    pid1005             MyApp    -[MyAppAppDelegate setWindow:] return

I then build and ran the release build and got the same basic results:

~ $sudo dtrace -l -n 'pid1221:MyApp::entry'
   ID   PROVIDER            MODULE                          FUNCTION NAME
26601    pid1221             MyApp                             start entry
26602    pid1221             MyApp                              main entry
26603    pid1221             MyApp -[MyAppAppDelegate myRandomMethod] entry
26604    pid1221             MyApp        -[MyAppAppDelegate window] entry
26605    pid1221             MyApp    -[MyAppAppDelegate setWindow:] entry
26606    pid1221             MyApp -[MyAppAppDelegate applicationDidFinishLaunching:] entry
26607    pid1221             MyApp                      stub helpers entry
~ $sudo dtrace -l -n 'pid1221:MyApp::return'
   ID   PROVIDER            MODULE                          FUNCTION NAME
70945    pid1221             MyApp                              main return
70946    pid1221             MyApp -[MyAppAppDelegate myRandomMethod] return
70947    pid1221             MyApp        -[MyAppAppDelegate window] return
70948    pid1221             MyApp    -[MyAppAppDelegate setWindow:] return
70949    pid1221             MyApp -[MyAppAppDelegate applicationDidFinishLaunching:] return

This surprised me a bit. The Release build should have all of the symbols stripped from it and yet the method names are still available. I figure this is expected, but it did surprise me.

I then ran it with my main application and got a similar error as before:

~ $sudo dtrace -l -n 'pid1247:myApp::return'
dtrace: invalid probe specifier pid1247:myApp::return: failed to create return probe for '-[NNASoundManager initializeSounds]': Invalid argument

However, this error was only seen with a release build. With the Debug build, I get all of the expected output.

Any idea why this error might be generated?




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: DTrace Questions
      • From: Ken Thomases <email@hidden>
References: 
 >DTrace Questions (From: Eric Gorr <email@hidden>)
 >Re: DTrace Questions (From: Jonas Maebe <email@hidden>)
 >Re: DTrace Questions (From: Franklin Marmon <email@hidden>)

  • Prev by Date: Re: Doxygen & QuickHelp
  • Next by Date: Re: Doxygen & QuickHelp
  • Previous by thread: Re: DTrace Questions
  • Next by thread: Re: DTrace Questions
  • Index(es):
    • Date
    • Thread