[swift-users] How to debug Segmentation Fault

Maxim Veksler maxim at vekslers.org
Wed Feb 1 19:00:44 CST 2017


I had some code work great on Mac and seg fault on Linux, bug demo[1] and
bug report[2]. It took me some time to narrow it down using print()'s,
essentially running a binary search to identify the point at which program
election halts, leading to a seg fault.

My method, though effective is probably barbaric. It's been years since
I've touched code that can actually seg fault, and I'm rusty on how you
approach debugging such cases, I'm wondering both Mac and Linux, even
though my case is Linux only.

I'd appreciate any links and discussions of how to tackle this issue, as it
seems that the days of segmentation faulting code are big time coming back!
So let's get into shape.

Assuming the discussion turns into a valuable resource I'll work to
summarize it into some form of a blog post for the benefit of the community.

[1]
https://github.com/maximveksler/thank-you/tree/master/swift/DateFormatter
[2]  https://bugs.swift.org/browse/SR-3828
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170202/817c230f/attachment.html>


More information about the swift-users mailing list