Xcode 5 not printing exception detail - ios

I have a project built for iOS 7 and it worked fine so far, but after a Git merge, some settings or something became corrupted and exceptions are not outputted to console anymore. So the "Terminating app due to uncaught exception" error message is never displayed in console. I've tried the project on both the device and the simulator, same thing. I cannot find the reason why is this and how to fix it and I am humbly asking for your help.
The facts:
debugger is working and running,
debugger stops and highlights correct line,
all exceptions breakpoint is active,
NSLog commands are working,
po command in lldb is working.
What I have tried before asking for help?
Cleaning (including build folder) and rebuilding project,
Restarting Xcode,
Restarting OS X,
Reconnecting device,
Rebooting device.
What else can I do? Thank you for your help!

I ran into this issue when trying to debug an autolayout crash. Not sure if this applies to all cases, but here's my solution:
I did some hunting, and came across this link:
Investigating NSExceptions with LLDB
That led me to mess around with exception breakpoints to try to figure out what the issue was. In my case, I could always find the description on $eax, so I decided to add an action to the breakpoint, so I don't have to debug it each time. This caused it to always print $eax without a breakpoint, so it pretty much acts like I want it to (print the exception description, continue crashing).
Steps:
Solved the issue I was currently having, and I'm sure variations on this solution (po $ebx, po [NSThread callStackSymbols], etc) should get around most issues with missing exception descriptions.

Related

How do I debug a Thread 1: signabrt, debug console doesn't show any logs

My ios project builds and installs on the device but has a runtime crash after launcher screen finishes.
I'm looking in the debugger console but I don't see any logs to help me diagnose what is going on. My project was working correctly before I upgraded react-native-firebase from v3 to v4 https://github.com/invertase/react-native-firebase/releases. Stepping into or over the code doesn't show me any errors in the code itself.
I'm hesitant to log an issue with the react-native-firebase project before I understand what the error could be - and whether it was a simple error somewhere.
However, the error seems pretty cryptic and I don't have any clues on what's actually causing the runtime crash. Is there a way that I can read more verbose logs that might give more info on the crash?
add an Exception breakpoint: by going to the breakpoint tab (command + 8) and the click the add "+" button on the bottom left corner and click on Exception breakpoint - all exceptions.
That will pause the code exactly were the exception is being raced therefore you will be able to see the line of code that it is causing the crash.

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.

Seeing exception information in AppCode

I've been testing AppCode and I can't seem to find any information as to WHY an app is crashing.
I've added an exception breakpoint and I can see the line of code causing the crash but no info on why.
In Xcode the exception reason is printed into the console but in AppCode I just get "Exception = Exception Breakpoint".
Can someone point me in the direction of getting useful information out of the crash.
AppCode, Choses Run, View Break points settings, Click on "Log message to console" by default it is off.
Command liners use, shift-fn-command-f8
AppCode also prints the exception in the console, providing that you launch the app in debug mode (as, actually, the debugger does it).

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.

iOS: App freezes and gives me an SIGABRT in xcode

When I start my app everything goes well. But if I close it, I mean really close it, and then opens it again it shows me the last open view and the app is totally freezed and xcode shows an SIGABRT error.
I have done so much, it's not that easy to just step backwards and see where it breaks. Any ideas?
Have you added an Exception Breakpoint in XCode? If something's wrong in your execution (possibly as a result of stored state from the previous execution that is now being loaded?), then you'll be able to see exactly where an exception happened before the program received the SIGABRT.
Ehm ok I might have done a noobie misstake...
I disconnected my phone from my computer (with the app totally closed) opened it and closed it again. Now when I open it, everything works. I guess you can't do that when running from xcode... he he...

Resources