debugging rubymotion

14

Click here to load reader

Upload: joshua-ballanco

Post on 15-May-2015

525 views

Category:

Technology


0 download

DESCRIPTION

Slides from the presentation on "Debugging RubyMotion" given at the RubyMotion #inspect 2013 conference.

TRANSCRIPT

Page 1: Debugging RubyMotion

How to Debug RubyMotion Apps

The Life and Times of an Object

Page 2: Debugging RubyMotion

My App Crashed!

Now what???

Page 3: Debugging RubyMotion

Weapon of Choicegdb

• rake debug=1

• Watch it crash

• Play!

Page 4: Debugging RubyMotion

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

Demo

Page 6: Debugging RubyMotion

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

Demo

Page 8: Debugging RubyMotion

4 Rs of Bug Reporting

• Reproduce

• Report

• Reduce

• Regress

Page 9: Debugging RubyMotion

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

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

Reduce It!

• Eliminate libraries

• Simple scripts are best

• Shrink code as much as possible!

Page 12: Debugging RubyMotion

Regress It!

• Did it used to work?

• motion update [--force-version=X]

Page 13: Debugging RubyMotion

Demo

Page 14: Debugging RubyMotion

Questions?

@manhattanmetric

Joshua Ballanco

https://github.com/jballanc

http://www.burnsidedigital.com