Skip to content

Instantly share code, notes, and snippets.

@maxfell
Last active August 18, 2018 20:55
Show Gist options
  • Save maxfell/186a27175a205338db67 to your computer and use it in GitHub Desktop.
Save maxfell/186a27175a205338db67 to your computer and use it in GitHub Desktop.
Symbolicating crash reports of bitcode apps without a matching dSYM file

Symbolicating crash reports of bitcode apps without a matching dSYM file

Seems like there is a bug in iTunes Connect where XCode doesn't fetch the correct dSYMs, which is quite a nightmare. However, whith a little help of the atos tool we can squeeze some code out of the crash.

I wrote a simple ruby script that goes through all unsymbolicated lines of a crash file and replaces them their symbolicated amigo. It works like this:

ruby symbolicate.rb MyApp.app/MyApp the_crash.crash
#!/usr/bin/env ruby
report = File.read(ARGV[1])
regex = /\d\s*.*\s*(0x.*) (0x.*) \+ (.*)/
report = report.gsub regex do |match|
v = match.scan(regex)[0]
puts "Symbolicating #{v[0]} #{v[1]} + #{v[2]}"
symbolicated = match.gsub(/0x.*$/, %x{xcrun atos -o #{ARGV[0]} -arch arm64 -l #{v[1]} #{v[0]}}).strip
symbolicated =~ /0x.* \(in .*\)/ ? match : symbolicated
end
out_file = File.new("symbolicated-" + ARGV[1], "w")
out_file.puts report
out_file.close
puts "\nSaved to #{File.basename(out_file)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment