Debugging a hang on OS X

  • Revision slug: Debugging_a_hang_on_OS_X
  • Revision title: Debugging a hang on OS X
  • Revision id: 172085
  • Created:
  • Creator: Hwaara
  • Is current revision? No
  • Comment how to make a sample, if an application hangs on OS X using Sampler.app

Revision Content

If you find a hang in an application, it is very useful for the developer to know where in the code this hang happens, especially if he or she can't reproduce it. Below are steps you can use to attach so-called "Samples" to bug reports.

Creating the sample

  1. When the application is still hung, open up Sampler.app (it's in your <tt>/Developer/Applications/Performance Tools/</tt> folder).
  2. Choose File > Attach...
  3. Select "firefox-bin" or the hung application you want a sample from.
  4. Now, click "Start recording". Note that only 3-4 seconds usually suffice, note that this will quickly hog up a lot of memory if you leave it on for too long!
  5. When it's done parsing the data, you should now have a couple of rows with stacktraces for all the threads in the sampled application.

Exporting it to a usable form

When you have the raw Sample data, you can't just save that and attach it to a bug, because the format is not very usable (unless the developer is a mac hacker). Export it like this:

  1. (Optional) Choose Tools > Invert Call Graph
  2. Choose Tools > Generate Report, and attach this as a text file to the bug report.

The final data will show where the application spent all its time when it was hung, and hopefully your bug will be easier to fix now!


See also: Debugging on Mac OS X

Revision Source

<p>If you find a hang in an application, it is very useful for the developer to know where in the code this hang happens, especially if he or she can't reproduce it. Below are steps you can use to attach so-called "Samples" to bug reports.
</p>
<h4 name="Creating_the_sample"> Creating the sample </h4>
<ol><li> When the application is still hung, open up Sampler.app (it's in your <tt>/Developer/Applications/Performance Tools/</tt> folder).
</li><li> Choose File &gt; Attach...
</li><li> Select "firefox-bin" or the hung application you want a sample from.
</li><li> Now, click "Start recording". Note that only 3-4 seconds usually suffice, note that <b>this will quickly hog up a lot of memory</b> if you leave it on for too long!
</li><li> When it's done parsing the data, you should now have a couple of rows with stacktraces for all the threads in the sampled application.
</li></ol>
<h4 name="Exporting_it_to_a_usable_form"> Exporting it to a usable form </h4>
<p>When you have the raw Sample data, you can't just save that and attach it to a bug, because the format is not very usable (unless the developer is a mac hacker). Export it like this:
</p>
<ol><li> <i>(Optional)</i> Choose Tools &gt; Invert Call Graph
</li><li> Choose Tools &gt; Generate Report, and attach this as a text file to the bug report.
</li></ol>
<p>The final data will show where the application spent all its time when it was hung, and hopefully your bug will be easier to fix now!
</p><p><br>
See also: <a href="en/Debugging_on_Mac_OS_X">Debugging on Mac OS X</a>
</p>
Revert to this revision