Reputation: 8160
So I recently made a code that handles SIGSEGV signals when it happens, such as when trying to use unitialised pointers. However, for some reason, stack overflows (as indicated by valgrind) fails to call the SIGSEGV signal handler.
Is this standard behavior, or is it just a GCC quirk?
Also, since I've been using backtrace() functionality to figure out what went wrong, would it be right to assume that this won't be accessible because the stack overflow means it won't be possible to get a stack trace (such as the stack too big to print etc)?
It is actually pretty hard to google information about this, as anything related to "stack overflow" goes to this site.
Upvotes: 1
Views: 236
Reputation: 3929
It should be impossible to call anything but a systemcall when the stack overflows ,since a functioncall will add more to an overflowed stack.
Upvotes: 0
Reputation: 101506
There's no such thing as either a stack overflow or a signal in C++, ironically. So this behavior you see is a platform-specific manifestation of some undefined behavior somewhere.
Upvotes: 2