{"id":8,"date":"2011-03-22T16:29:25","date_gmt":"2011-03-22T16:29:25","guid":{"rendered":"http:\/\/conorburgess.com\/wordpress\/?p=8"},"modified":"2012-03-30T11:52:54","modified_gmt":"2012-03-30T10:52:54","slug":"atos-for-debugging-crashlogs","status":"publish","type":"post","link":"https:\/\/conorburgess.com\/wordpress\/?p=8","title":{"rendered":"ATOS for Debugging CrashLogs"},"content":{"rendered":"<p>With dSYM files and Instruments, there is little cause for iOS developers to manually symbolicate Crash Logs anymore.<\/p>\n<p>However, if you\u2019re a Jailbreak developer, chances are you\u2019ll be  compiling dynamic libraries &amp; executables and not apps. This means  no Instruments and no dSYM files.<\/p>\n<p>So what do you do when you get an email from Cydia (assuming it\u2019s not  blank ofcourse!) with a Crash Log and a disgruntled user who keeps  getting SpringBoard crashes after installing your tweak?<\/p>\n<p>Hopefully the log will be symbolicated with Crash Reporter, but this  might not be much use. What I would do is take a look and see if I can  work out what my code was doing just before the crash. Unfortunately,  this is (in my experience) rarely enough to find a crash, unless it\u2019s a  fairly obvious mistake.<\/p>\n<p>So you send the user an email thanking them for taking the time to  send you the Crash Log and say you\u2019ll do your best to fix it. Trouble is  you\u2019re still not sure where to start.<\/p>\n<p>Before dSYM and Instruments, developers used a tool called ATOS. This  same tool can come to the rescue now for Jailbreak devs. What ATOS does  is converts meaningless stack trace addresses to useful filenames and  linenumbers.<\/p>\n<p>To use ATOS to it\u2019s full potential, you\u2019ll need to add the -gstabs  compiler flag to your makefile. This will include the extra symbols  required to give you line numbers. Without it, ATOS can\u2019t tell you what  is causing the problem in any format you will understand (as the  relevant symbols will be stripped from the binary). Using the -g  compiler flag will keep enough symbols to let ATOS tell you which  function was running just before the crash, but it can\u2019t tell you line  numbers. It is a good trade off between debugging potential and  executable size.<br \/>\n<strong> Remember to remove the -gstabs flag before you compile your  production build, as the extra symbols massively increase the size of  your executable and can apparently cause problems.<\/strong><\/p>\n<p><strong>If you are compiling with theos\/logos, use:<\/strong><br \/>\n<code>make CFLAGS=-gstabs DEBUG=1<\/code><\/p>\n<p>OK so how do you use this magical tool? It\u2019s an easy command line tool:<br \/>\n<code>atos -o [Executable path] -arch armv6 [stack trace address]<\/code><\/p>\n<p>For example, from this stack trace:<br \/>\n<code>21 \u00a0HTCPlugin 0x058ab084 0x5894000 + 94340<\/code><\/p>\n<p>The memory address we need is 94340. This stack trace was the last of  my code to be called in the crashed thread. This gives us the command:<br \/>\n<code>atos -o [Path to HTCPlugin executable] -arch armv6 94340<\/code><\/p>\n<p>This command will then tell me which line of which file was executing  just before the crash occured, so I know exactly where to start looking  when it comes to debugging the crash.<\/p>\n<p>One final note, the executable you use with ATOS must be exactly the  same as the one that created the crash log, or compiled from exactly the  same source code. Even a minor difference will cause ATOS to either  produce incorrect results or fail to find a line number at all.<\/p>\n<p>Hopefully this will come in useful to some people \u2013 Happy Debugging!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With dSYM files and Instruments, there is little cause for iOS developers to manually symbolicate Crash Logs anymore. However, if you\u2019re a Jailbreak developer, chances are you\u2019ll be compiling dynamic libraries &amp; executables and not apps. This means no Instruments and no dSYM files. So what do you do when you get an email from &hellip; <a href=\"https:\/\/conorburgess.com\/wordpress\/?p=8\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">ATOS for Debugging CrashLogs<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1,3],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-general","category-jailbreak"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4zPbt-8","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":2,"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":98,"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions\/98"}],"wp:attachment":[{"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/conorburgess.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}