EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) Only when running app on device from Xcode - ios

I'm getting a really weird EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) crash on my app which is written in swift but only when i run it on a 32 bit device and only if its running from Xcode (the device is still hooked to Xcode), If i start the app without Xcode it runs fine. I can't give any code since no matter what i do i get no stack trace or anything like that .Only the mention error on the AppDelegate, even though the crash is in different screens further in the app (crashes on second screen).
Any idea as to why the crash would happen only when Xcode is running the app

You are using some variable or object which is yet to be initialised. Please review your code and you will get the error. You can add exceptional break point to get the actual position of the error.

It's a memory alignment issue. Search on EXC_ARM_DA_ALIGN.
https://brewx.qualcomm.com/bws/content/gi/common/appseng/en/knowledgebase/docs/kb95.html

use memcpy
char*Code; int pc;
double f;
memcpy(Code+pc, &f, sizeof(f)); // instead of *(double*)(Code+pc)=f; that generates EXC_ARM_DA_ALIGN

Related

Xcode 9 crashing when running split view app on iPhone

After working just fine on both iPhone and iPad for a month, my Xcode 9 app has consistently started crashing causing me the following fatal problem: When I build & run it on an iPhone (simulator or device) Xcode completes loading the app and then crashes too fast for me to copy/paste the error from the debugger. When I run on iPad it works fine leading me to believe this is a result of something related to the split master/detail view.
If I use either an exception breakpoint or an "all C++ exceptions" it will stop at the AppDelegate class and crash if I hit play. If I use only an "all Objective-C exceptions" it will crash as before.
In the debug view hierarchy I get the following errors as well:
Error: Unable to capture view hierarchy.
Details: Log Title: Data source expression execution failure.
Log Details: error evaluating expression “(id)
[[(Class)objc_getClass("DBGTargetHub") sharedHub]
performRequestWithRequestInBase64:#"...
Log Method: -[DBGDataSourceConnectionLibViewDebugger
_executeLLDBExpression:forRequest:onPotentialThread:iteration:]
_block_invoke_2
Method: -[DBGViewDebugger updateDebugHierarchy]_block_invoke_2
I have tested other apps and this issue is unique to the app I am working on. Any ideas or debugging tips for how to proceed? I might just have to redo this whole project again if I can't even find the root cause of this! Appreciate any help.
Quick solution: Reset Simulator Device
I managed to resolve the above issue thanks to some serious digging. First, to resolve the instantaneous crash problem, I set a breakpoint at every line in the app delegate. That allowed me to narrow the error to a memory handling problem. From there I started running the code on one of each device available, and realized the crash only occurred on devices I had used earlier in development. Resetting those devices solved the problem.
The core issue here is that when you clean/rebuild your xcode program, it updates the app code on the device, but not necessarily the data model information. So when I changed my data model by including new data and renaming old data it was not properly updated.

iOS crash below iOS9.3 with SIGSEGV, different Crash Log

Many crashes happened below the iOS9.3 (which means devices with iOS10 are OK)..
The crash logs seem to show that it's not a problem about API that can only be used below iOS 9.3 .
But I have no idea about the crash logs. ( I'm sorry ...for I just start to study iOS development for only 2 month )
Could you please help me analyze the crash logs ?
Really Thanks !
crash log 1
crash log 2
AXE_BAD_ACCESS - this is problem with memory. One of function tried to use variable which already released. I think you need to check use your TableView and cells for this table.
Also to find problem with memory you can try to use zombies
Used to have the similar strange crashes in my app. And only in production, when testing from TestFlight. Building on device with ios 9 caused no problems.
Maybe it sounds strange, but try to convert all images you use in app to images with included sRGB color profile. For me it helped.

CoreFoundation Trap error "Thread1:EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)"

i need your help i've got this frustrating "random" error.
The app is compose of one Mapviewcontroller and a collectionview on the second controller.
Sometimes when I return to the map from the second controller the app suddenly crash with this error on the the "trap" line.
The crash report doesn't point to any of my lines of code.
EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)
I said "random error" because the same version of the same app could be build and run smooth for days, then suddenly it stuck. The only way to regain control of the app is to delete manually from the iPad and rebuild.
For your information the app uses Coredata.
Any ideas? Some method to figure out where the error come from?
Any help is appreciated, thanks!
I had this error on line like that
NSLog(#"%#: tutorial view retain count = %ld",self.class,CFGetRetainCount(CFTypeRef(tutorialView)));
where tutorialView equals nil
Restart your iOS device - that worked for me. You can also try restarting Xcode.
I was getting the crash where I had a breakpoint set, but I had breakpoints turned off. I think that there are glitches in how Xcode handles breakpoints that can cause this issue even if there aren't issues in the code itself.

iOS App crashes when setting breakpoint in Xcode

I have an app I'm developing where setting a breakpoint in Xcode while the app is running causes it to crash. At least I assume it is a crash. There is nothing in the console saying what happened. The app just terminates.
Note that the break point is not being hit, just the act of setting it causes this.
I've developed many apps and this is the first to act like this. Does anyone have any ideas what could be happening or how to figure this out? It is really slowing down my debugging.
I'm assuming you're using Xcode 4.x. Try going into your scheme's settings and switch to a different debugger (GDB if you have LLDB currently set, or vice versa).
If that doesn't work, we need more info:
which version of Xcode and iOS are you using?
does the problem occur in the Simulator or on your device, or both?
have you tried placing a breakpoint in different places in your code?
As far as I can tell, it's a debugger issue. So your app does not actually crash, it's the debug session that crashes which causes the app to terminate. You can observe a similar effect when you hit Stop in Xcode or disconnect your device while an app is attached to the debugger in Xcode.
Might be an issue with mismatching Xcode and iOS versions. Please provide more info about your environment to help diagnose the problem.

App crashes without reason with xCode 4

Something weird is going on here.
My app crashes on this line of code:
int end = NSMaxRange(endRange);
but I don't get any error message, and everything is fine: endRange. The app just freezes in the iPhone and that's it.
1.
The weird thing is that the same code was working before, and I've reversed from repository to see what's wrong but it still doesn't work.
2.
Also xCode removes the breakpoint every time the app crashes. I add it again, I run the app, I step over, the app crashes and Xcode removes the breakpoint.
3.
I've cleaned the build, restarted xCode, restarted the iPhone, removed the app from the iPhone. Same issues.
4.
If I don't use breakpoints, the app doesn't crash, but the code right after that line is "skipped", but it was working before. At least the app doesn't freeze without breakpoint.
What the hell ?
I've had similar problems with the debugger in the past too. Try switching from LLDB back to GDB (From the Product / Edit Scheme menu). I've found LLDB to do exactly what you are describing with breakpoints.

Resources