Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use DTrace to monitor a running application to see the methods and the classes that are called. You can easily monitor an iOS app running in the Simulator using DTrace on the command line, First you will need to find the PID of the application using <code>ps</code> and then you can run a DTrace probe like the following:</p> <pre><code>sudo dtrace -q -n 'objc1234:::entry { printf("%s %s\n", probemod, probefunc); }' </code></pre> <p>where 1234 is the process ID of the app.</p> <p>This will produce output that looks like the following:</p> <pre><code>UIStatusBarItemView -isVisible UIStatusBarLayoutManager -_positionAfterPlacingItemView:startPosition: UIView(Geometry) -frame CALayer -frame UIStatusBarLayoutManager -_startPosition UIView(Geometry) -bounds CALayer -bounds UIStatusBarItemView -standardPadding UIStatusBarItem -appearsOnLeft UIStatusBarItem -leftOrder </code></pre> <p>If you are only interested in tracing a single class, <code>UIView</code> for example, you could use:</p> <pre><code>sudo dtrace -q -n 'objc1234:UIView::entry { printf("%s %s\n", probemod, probefunc); }' </code></pre> <p>If you wanted to trace all calls to <code>dealloc</code> on all classes, you would use:</p> <pre><code>sudo dtrace -q -n 'objc1234::-dealloc:entry { printf("%s %s\n", probemod, probefunc); }' </code></pre> <p>Obviously, you could combine these to only see <code>UIView</code> <code>dealloc</code>s:</p> <pre><code>sudo dtrace -q -n 'objc1234:UIView:-dealloc:entry { printf("%s %s\n", probemod, probefunc); }' </code></pre> <p>If you want to be able to distinguish a specific object of a class you could also print the memory address of the object (<code>self</code>) using the following:</p> <pre><code>sudo dtrace -q -n 'objc1234:UIView:-dealloc:entry { printf("%s (0x%p) %s\n", probemod, arg0, probefunc); }' </code></pre> <p>DTrace is extremely powerful and can do considerably more than I've shown here.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload