iPhone Crash with "No Backtrace" - iphone

My iPhone app was recently rejected from the App Store "because it crashes on launch". However, I cannot reproduce this crash. The app works perfectly on both the simulator and a device with the same hardware and software Apple tested it on (iPhone 3.1 running iOS 4). The crash logs they sent me say "No Backtrace Available", so I have nowhere to look in my code. Here's an example:
Incident Identifier: [...]
CrashReporter Key: [...]
Hardware Model: iPhone3,1
Process: [MyApp] [1172]
Path: /var/mobile/Applications/[...]-3F1B-4504-A572-[...]/[MyApp].app/[MyApp]
Identifier: [MyApp]
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2010-07-08 [...]
OS Version: iPhone OS 4.0 (8A293)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xfe42c648
Highlighted Thread: 0
Backtrace not available
Unknown thread crashed with ARM Thread State:
r0: 0x00002388 r1: 0x00000000 r2: 0x3e2b47c8 r3: 0x00000108
r4: 0x2fe00000 r5: 0x00000000 r6: 0x00000000 r7: 0x00000000
r8: 0x2ffffb48 r9: 0x2fffecfc r10: 0x00000000 r11: 0x00000000
ip: 0x00000010 sp: 0x2ffffb4c lr: 0x2fe08907 pc: 0xfe42c648
cpsr: 0x40000010
Binary Images:
0x1000 - 0x78fff +[MyApp] armv7 <23af3d265c3086eaceb51cc649eb794f> /var/mobile/Applications/[...]-3F1B-4504-A572-[...]/[MyApp].app/[MyApp]
0x2fe00000 - 0x2fe26fff dyld armv7 <697ae459733a7f0b6c439b21ba62b110> /usr/lib/dyld
[many more libraries...]
How can I begin debugging this? Is it possible this is a build issue rather than a coding bug? And can I extract any useful information from the "ARM Thread State" or the "Binary Images" portions of the crash report?
Thanks!
*update: * I have installed the app for the first time on another iPhone running iOS 4 and still cannot reproduce the crash. I'm beginning to think this is an issue with build-time parameters such as libraries or targeted versions. Based on the crash report, is it likely that any of my application's code was executed?

See Technical Note TN2151:Understanding and Analyzing iPhone OS Application Crash Reports. Symbolication would normally help you track down the source of a crash but since there is no backtrace it may not help in this instance.
Don't bother testing on the simulator. The simulator build and the device build are wholly separate compiles for two different pieces of hardware. Just because it runs on simulator tells you nothing about a failure on device.
Remember that Apple will stress test the app by doing things like launching it on iOS4 with other apps eating up most of the memory. You will need to do that as well on your test device.
You will most likely have to wipe your test device back to defaults to replicate the test Apple does. Then open every possible app before launching your own.

You can make some information from the ARM thread state. The PC register is the only one containing the invalid address that the crash report is complaining about. That means your app tried to execute code at that address.
SIGSEGV means that the address in question is invalid. The system has setup no memory pages with this address.
I don't think the iOS will allow you to simply execute code from any address, but it is possible that the stack frame was corrupted and the return address was invalid when a function returned. That supports the "backtrace not available" problem.
Fouling the stack may be a result of a buffer overrun. If you use memcpy or a loop of sets on a local variable array and overrun the end of the array, you can destroy the stack.

A segfault is unlikely to be a build error. To reproduce this problem, try clearing out any saved information on the iPhone simulator before running the project; it is possible that you are assuming the existence of certain entries in NSUserDefaults that are present on your own iPhone, but which would not be available on a default installation. If that doesn't reproduce the problem, then you should create unit tests for each of your components, ruling out each component at a time as the cause of failure. Eventually, you will have ruled out every cause of failure except for the true cause of failure.

I was never able to reproduce the crash. I messed with a few build params and resubmitted and it was approved.

Related

App crash , Xcode11.4, iOS 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s)

Our app crash on os 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s 32) compiled by Xcode 11.4, swift optimization on. We find the PC register point to a hole address without virtual address and no stack information. If we close swift optimization, it works.
So do anyone find the problem and any solution?
It's certain that it's related to Xcode 11.4 swift optimization.
I find the same question here. https://www.reddit.com/r/iOSProgramming/comments/frcpsc/xcode_114_builds_crashes_on_ios_10/
Incident Identifier: 2224949E-E5E3-479C-9B08-4FD1473144B3
CrashReporter Key: 052c9a28855da965790a6dcc0885097a66ee4eff
Hardware Model: iPad3,4
Process: AAAAA [34872]
Path: /private/var/containers/Bundle/Application/xxxxxx....
Identifier: com.xxx.xxxxx
Version: xxxx
Code Type: ARM (Native)
Role: Non UI
Parent Process: launchd [1]
Coalition: com.xxx.xxxxx [1932]
Date/Time: 2020-03-30 22:42:49.2564 +xxx
Launch Time: 2020-03-30 22:42:47.0000 +xxx
OS Version: iPhone OS 10.3.3 (14G60)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x015fa500
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 ??? 0x015fa500 0 + 23045376
After lots of analysis such as log and instruction debug, I am surely it's a bug xcode 11.4 swift compiler optimization.
Detailedly, the optimization cause a stack pointer (fp) messy at the point opening a new function stack frame.
I show it in the following.
Here is a helper function type metadata accessor for myapp.MainViewController at <compiler-generated> generated by compiler in our mainviewcontroller.
<+0>, <+4> is wrong. It should be
0x6cd85c <+0>: push.w {r4, r5, r6, r7, lr}
0x6cd860 <+4>: add r7, sp, #0xc
r7 is fp. so the error instruction <+0> don`t save r7, and <+4> sub ins makes r7 lower than sp a lot that causes all whole stack messy. So It's wrong clearly.
This is what happens when the ins execute.
Before:
After:
The whole stack loses becuase of fp error.
And we can also verify that in xcode 11.3.
<+0> <+2> is the same as our expectation above.
So we have to downgrade to xcode 11.3 as well and use runtime refection to adapt new iOS SDK feature that should be call in xcode 11.4.
We have also encountered multiple crashed on old 32-Bit devices with iOS 9 or 10. Recompiling with Xcode 11.3.1 fixed those random crashes in my case...
There is also a open Bug for this topic at https://bugs.swift.org/browse/SR-12511
This is fixed for us in Xcode 11.5.
GM_Seed which is available since May 18.
https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.5_GM_Seed/Xcode_11.5_GM_Seed.xip

"Unable to read symbols for..." causing to crash iPhone app on device (not with simulator)

I hope anybody can help me with the following:
The problem
I'm getting the following error when running my app on a device (iPhone 3G):
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/info/dns.so (file not found).
It doesn't display images such as Default.png or other placeholders I'm using. I think that's related to the problem.
What I've tried
Clearing builds, logs etc.
Removing the folder DeviceSupport and restoring it with my iPhone. This solutions has been approved by 44 people but it did not work for me. See UUID mismatch detected with the loaded library for more information.
I'm using (in case it matters)
an iPhone 3G with iOS 4.2.1. (8C148)
Xcode 3.2.5 with iOS 4.2 as latest iOS)
Also here's the complet log when starting my app. It doesn't crash right away. Only when I go to a specific view.
GNU gdb 6.3.50-20050815 (Apple version gdb-1510) (Fri Oct 22 04:12:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
Loading program into debugger…
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-7740-50
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
run
Running…
[Switching to thread 11523]
[Switching to thread 11523]
sharedlibrary apply-load-rules all
continue
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/info/dns.so (file not found).
Thanks in advance!
You mention that you have iOS 4.2 with Xcode 3.2.5, but you have 4.2.1 on the device. Do you have the 4.2.1 SDK installed? You need to have the same build (8C148) on both.
I'm not sure how or why but this error disappeared when I corrected 2 other errors.
First of all I used a placeholder .png in jpeg format (saved it the wrong way, dumb I know).
The other thing wasn't too bright either: I mislinked my NIB to a class that didn't exist.
Simulator can handle both, a real device couldn't. But since I fixed these errors, the error in my question disappeared too..

app not launching on iPhone (iOS 5)

Just installed and app on my iPod touch using a developer provisioning profile. The app works fine some time but after some time it fails to start on iPod (iOS 5) touch, just tries to launch but in half way through closes .... even the splash is also not visible.
I checked the crash log from device says something like this.
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread: 0
Dyld Error Message:
Library not loaded: /Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit
Referenced from: /var/mobile/Applications/DBC8A071-F305-4095-8FF5-76DDC99DDDEE/ApplicationName.app/ApplicationName
Reason: image not found
Dyld Version: 199.5
Binary Images:
0x1000 - 0x72fff +ApplicationName armv7 <1f10c6b4168c3503908fead68d17ddb5> /var/mobile/Applications/DBC8A071-F305-4095-8FF5-76DDC99DDDEE/ApplicationName.app/ApplicationName
0x2fe79000 - 0x2fe9afff dyld armv7 /usr/lib/dyld
From log it seems like its failing to load the SenTestingKit library but how it works for some time????
And if I remove this framework what should be the alternative for iOS 5.
Please shed some light on this rather strange issue.
You should only be linking to SenTesting in your Testing target.
First:
Try to delete the derived Data, then clean the project and restart Xcode. If its still not working, check the Target dependencies of your library.
Second: Try to mark the SenTestingKit as "optional".
There are some problems with loading libraries in iOS 5, so just try to clean the project in xCode 4 and build it again. That maybe help you, because after a cleaning all paths will be set up for new.

Instruments (Leaks/Activity Monitor/Time Profiler etc.) won't start - what's going on?

I'm sorry if this question was somewhere here already, but I'm struggling with this problem for hours with no results. Long story short - I have a fresh installation of Xcode (version 3.2.5 64bit) and when I try to run my app with a performance tool (let's say Leaks), Instruments just crash, no matter which tool I choose. As I'm a beginner when it comes to Xcode I have no clue what's wrong. Please find the crash report below:
Process: Instruments [4033]
Path:
/Developer/Applications/Instruments.app/Contents/MacOS/Instruments
Identifier: com.apple.Instruments
Version: 2.7 (3017) Build
Info: Instruments-30170000~6 Code
Type: X86-64 (Native) Parent
Process: launchd [172]
Date/Time: 2011-03-29
19:43:52.996 +0100 OS Version:
Mac OS X 10.6.7 (10J3250) Report
Version: 6
Interval Since Last Report:
118589 sec Crashes Since Last Report:
14 Per-App Interval Since Last Report:
24 sec Per-App Crashes Since Last
Report: 5 Anonymous UUID:
5934F52C-EF00-40F1-A0B4-17D52FA623F1
Exception Type: EXC_BREAKPOINT
(SIGTRAP) Exception Codes:
0x0000000000000002, 0x0000000000000000
Crashed Thread: 0 Dispatch queue:
com.apple.main-thread
Dyld Error Message: Symbol not
found:
_CSSymbolicatorCreateWithMachKernel Referenced from:
/Developer/Applications/Instruments.app/Contents/MacOS/../../../../Library/PrivateFrameworks//InstrumentsPlugIn.framework/Versions/A/InstrumentsPlugIn
Expected in:
/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication
Has anyone experienced something like this before or knows how to fix it? I hope I've formulated my problem descriptively enough. I'd appreciate your help!
Thanks!
After days of fruitless struggle I have just updated my Xcode to version 4 and everything works perfectly fine. I still have no idea what was wrong with my previous installation, but since my Instruments work now, I won't investigate in any longer.

iPhone app crashes on 3.1.2 after approvement, but not on 3.2 & 4.0.x

After App Store approvement my app started to crash on launch on 3.1.2 devices. Debug version installed from Xcode works fine on 3.1.2. Both debug and distribution version from App Store work fine on 3.2 and 4.0.1 devices. From crash log:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Any ideas what could be wrong?
Does it crash on start or after a specific scenario?
First you have to make sure that that the target 3.1.2 is unmodded/jailbroken, as it might affect some binaries. Also, make sure that it is the same device that tested both debug and release versions.
Check for any 3.2 (and above) specific messages that you send.
After that, either modify your code and check using respondsTo: as in:
if ([receiver respondsTo:someMessage]) {
[receiver someMessage];
} else {
// Some alternative code
}
or modify your version requirement. But be careful about this decision because this will limit your market.