3 ms·
To recap, if you want to implement your own exceptions in C++ with the stack trace in the same way as Java or C# do, that's good fun. Just use Google Breakpad.
by js2 11y ago
To recap, if you want to implement your own exceptions in C++ with the stack trace in the same way as Java or C# do, that's good fun.
Just use Google Breakpad. For Objective-C, you'll probably do better with PLCrashReporter (or possibly KSCrash) which can reliably unwind at the time of the crash because of certain assumptions it can make about ObjC binaries that the more general Breakpad does not make. (Breakpad just captures the stacks to a minidump, which you then unwind later using symbol files generated from your binaries.)
you usually need to allocate a piece of memory in the heap
Breakpad preallocates. The ObjC (Mac, iOS) handler included with Breakpad (should you go that route) goes so far as to mprotect the preallocated memory to help protect it from memory smashers.
None of this is perfect, but I'd rather have stack traces than not. It's also useful to have a breadcrumb mechanism in the app to include with the stack trace.