Re:Xcode 9.1 Improves Display of Fatal Errors
by matwood on Friday October 06, 2017 @01:31PM
(#15418575)
One thing I've never understood is why break on all exceptions is not the default in Xcode. It'll happy crash the app with an assembly stack trace with no way to see the offending code unless break on all exceptions is setup.
[ Parent
| on HN ]
Re:Xcode 9.1 Improves Display of Fatal Errors
by eridius on Friday October 06, 2017 @01:45PM
(#15418716)
Because there's no way for the debugger to only break on uncaught exceptions, and you don't usually want to break on caught exceptions. Various frameworks (most infamously CoreData) use caught exceptions internally as a control flow tool.
Re:Xcode 9.1 Improves Display of Fatal Errors
by favorited on Friday October 06, 2017 @02:26PM
(#15419097)
I've never seen this with Core Data (unless you have the multithreading-violation argument set). I do see it with some of the AV frameworks, but those are C++ exceptions, so as long as I only break on ObjC exceptions I don't hit it.
Edit: I forgot 1 ObjC exception I see frequently from AVFoundation on macOS. That one does cause an annoying breakpoint hit.
Re:Xcode 9.1 Improves Display of Fatal Errors
by matwood on Friday October 06, 2017 @02:36PM
(#15419206)
It's been awhile since I've used CoreData, but I don't remember these being an issue.
Re:Xcode 9.1 Improves Display of Fatal Errors
by agildehaus on Friday October 06, 2017 @02:48PM
(#15419309)
Maybe if it were the default various frameworks would be less likely to use exceptions as flow control.
Re:Xcode 9.1 Improves Display of Fatal Errors
by pavlov on Friday October 06, 2017 @03:17PM
(#15419584)
There are a few places in AppKit where you need to determine an object's state by catching an exception because there's no method available. (Checking whether an NSColor is a pattern comes to mind -- only way is to try getting the pattern image and it will throw if it's not a pattern color.)
The really frustrating thing is that Obj-C didn't even have exceptions originally, so someone basically looked at exceptions when they were added and thought: "I know, I'll use them as part of the API"...
Re:Xcode 9.1 Improves Display of Fatal Errors
by mnem on Friday October 06, 2017 @03:43PM
(#15419794)
Can't you check if the NSColor.type == NSColorTypePattern?
Re:Xcode 9.1 Improves Display of Fatal Errors
by pavlov on Friday October 06, 2017 @03:57PM
(#15419897)
I might be misremembering that one! Will have to check. Thanks!
Re:Xcode 9.1 Improves Display of Fatal Errors
by eridius on Friday October 06, 2017 @04:28PM
(#15420171)
NSColor.type is new in macOS 10.13.
Re:Xcode 9.1 Improves Display of Fatal Errors
by saltypal on Friday October 06, 2017 @05:33PM
(#15420641)
There are some pretty solid approaches over on my SO question (particularly the lldb Python script—been using this one for years.) https://stackoverflow.com/q/14370632/798224
Re:Xcode 9.1 Improves Display of Fatal Errors
by marosoaie on Sunday October 08, 2017 @07:09AM
(#15427779)
Right, calling save on a NSManagedObjectContext often throws c++ exceptions.
Re:Xcode 9.1 Improves Display of Fatal Errors
by pkamb on Friday October 06, 2017 @03:12PM
(#15419536)
Remember to turn off C++ exceptions or you'll constantly be breaking on `return UIApplicationMain(...)`
https://stackoverflow.com/questions/26127004/xcode-throws-an...