开发者

Getting SIGSEGV when stack overflow happens in c++

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 po开发者_开发问答ssible 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.


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.


It should be impossible to call anything but a systemcall when the stack overflows ,since a functioncall will add more to an overflowed stack.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜