Debugging a hang on Mac OS X: Difference between revisions
Jump to navigation
Jump to search
(timeless asked me to put this into wiki) |
(describe how to use Sampler.app to sample a hung app on OS X, remove irrelevant Shark info (Shark is for profiling, and is too advanced to advise here)) |
||
Line 1: | Line 1: | ||
If an application | 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 === | ||
# When the application is still hung, open up Sampler.app (it's in your <tt>/Developer/Applications/Performance Tools/</tt> folder). | |||
# Choose File > Attach... | |||
# Select "firefox-bin" or the hung application you want a sample from. | |||
# 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! | |||
# 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: | |||
# ''(Optional)'' Choose Tools > Invert Call Graph | |||
# 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! |
Revision as of 15:23, 19 October 2006
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
- When the application is still hung, open up Sampler.app (it's in your /Developer/Applications/Performance Tools/ folder).
- Choose File > Attach...
- Select "firefox-bin" or the hung application you want a sample from.
- 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!
- 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:
- (Optional) Choose Tools > Invert Call Graph
- 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!