Update! The information in this blog post is mostly irrelevent now that you can type
rake crashlog:device to symbolicate crash logs from your device as of RubyMotion 2.18. Thanks!
Symbolicating a crash log is the process of finding a line number in source from a crash log. Crash logs often look like this. This specific process is interesting in particular to RubyMotion because Apple’s Xcode doesn’t symbolicate to Ruby code.
Now let’s see how it’s done.
rake device, you have binary files in the build directory, including a
.dSYM file. Go ahead and
cd into that directory, I’ll be typing all commands from that directory. Here is the directory listing for my
Next, we’re going to use a command called atos. You’ll need the load address, the architecture, and the list of addresses from the crash log. I’ll show where to get these from the crash log.
Here is the command I typed based on the crash log example:
xcrun atos -l 0xed000 -arch armv7 0x00a22a30 0x00a22b56 0x0098caec 0x00a20866 0x00a0a930 0x00a09a66 0x00a0a420 0x0080b524 0x0081241e 0x008124ae -o Redacted\ \(Dev\).dSYM/Contents/Resources/DWARF/Redacted\ \(Dev\)
The value for the
-l flag is taken from the Binary Images section. That first number there. The value for the
-arch flag is
arm7 since the binaries were built for an iOS device.
The rest of the hex numbers are taken from the first screen shot of the crash log. I copy/pasted them from the crash log for now (would like to hear of a better way). And I got this output:
got symbolicator for Redacted (Dev).dSYM/Contents/Resources/DWARF/Redacted (Dev), base address 4000 __vm_raise() (in Redacted (Dev)) + 276 rb_vm_raise (in Redacted (Dev)) + 82 rb_frozen_class_p (in Redacted (Dev)) + 72 rb_vm_method_missing (in Redacted (Dev)) + 358 rb_vm_dispatch (in Redacted (Dev)) + 3060 rb_vm_trigger_method_missing (in Redacted (Dev)) + 522 rb_vm_dispatch (in Redacted (Dev)) + 1764 vm_fast_plus (in Redacted (Dev)) + 356 __unnamed_28 (in Redacted (Dev)) + 274 rb_scope__commandDidStart:__ (in Redacted (Dev)) (login_view_controller.rb:56)
As you can see, the crash was in the login controller. Looking at that file, it’s the Facebook log in code.
Although having to copy/paste addresses into the command line isn’t ideal, the main goal is retrieving a line number in ruby code (although off by one) from an otherwise opaque crash log intended for Xcode. And this allows further debugging.