debugging rubymotion
DESCRIPTION
Slides from the presentation on "Debugging RubyMotion" given at the RubyMotion #inspect 2013 conference.TRANSCRIPT
![Page 1: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/1.jpg)
How to Debug RubyMotion Apps
The Life and Times of an Object
![Page 2: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/2.jpg)
My App Crashed!
Now what???
![Page 3: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/3.jpg)
Weapon of Choicegdb
• rake debug=1
• Watch it crash
• Play!
![Page 4: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/4.jpg)
What is an Object?
• Just a struct!
• First value is the isa pointer to the Class
• In gdb, try “x”
• Refer to the Obj-C Runtime Reference
![Page 5: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/5.jpg)
Demo
![Page 6: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/6.jpg)
Advanced WeaponryMallocStackLoggingNoCompact
• man malloc
• Set environment variables to log the stack during allocations
• Run in GDB, use malloc_history to view stacks
![Page 7: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/7.jpg)
Demo
![Page 8: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/8.jpg)
4 Rs of Bug Reporting
• Reproduce
• Report
• Reduce
• Regress
![Page 9: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/9.jpg)
Reproduce It!
• Can you make the bug occur every time? most of the time? some of the time?
• Check all config files, Rakefile
• Environment and Environment Variables
• Ask a friend
![Page 10: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/10.jpg)
Report It!• motion support
• All steps to reproduce
• bonus points for small sample apps
• RubyMotion Version (Have you updated recently?)
• Crash log (hint: look in Console.app)
![Page 11: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/11.jpg)
Reduce It!
• Eliminate libraries
• Simple scripts are best
• Shrink code as much as possible!
![Page 12: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/12.jpg)
Regress It!
• Did it used to work?
• motion update [--force-version=X]
![Page 13: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/13.jpg)
Demo
![Page 14: Debugging RubyMotion](https://reader038.vdocuments.mx/reader038/viewer/2022100600/5555a93ed8b42afe5d8b4697/html5/thumbnails/14.jpg)
Questions?
@manhattanmetric
Joshua Ballanco
https://github.com/jballanc
http://www.burnsidedigital.com