Can one use libSegFault.so to get backtraces for SIGABRT?

env SEGFAULT_SIGNALS=”abrt segv” LD_PRELOAD=/lib/libSegFault.so someapp Note that the actual path to the preload library may differ. On my machine, I’d use env SEGFAULT_SIGNALS=”abrt segv” LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so some-64bit-app or env SEGFAULT_SIGNALS=”abrt segv” LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so some-32bit-app depending whether the application I was running was compiled 64-bit or 32-bit. (You can use file to check.) The source tells us there … Read more

Saving custom Swift class with NSCoding to UserDefaults

In Swift 4 or higher, Use Codable. In your case, use following code. class Blog: Codable { var blogName: String? } Now create its object. For example: var blog = Blog() blog.blogName = “My Blog” Now encode it like this: if let encoded = try? JSONEncoder().encode(blog) { UserDefaults.standard.set(encoded, forKey: “blog”) } and decode it like … Read more

When does a process get SIGABRT (signal 6)?

abort() sends the calling process the SIGABRT signal, this is how abort() basically works. abort() is usually called by library functions which detect an internal error or some seriously broken constraint. For example malloc() will call abort() if its internal structures are damaged by a heap overflow.