Regarding the first question: What are the scenarios where a process gets a SIGABRT in C++?
I can think of two special cases where a C++ program is aborted automatically -- not by directly calling std::abort()
or std::terminate()
:
One: Throw an exception while an exception is being handled.
try {
throw "abc";
}
catch (...) {
throw "def"; // abort here
}
Two: An uncaught exception that attempts to propagates outside main()
.
int main(int argc, char** argv)
{
throw "abc"; // abort here
}
C++ experts could probably name more special cases.
There is also a lot of good info on these reference pages: