-
Nadav Har'El authored
Recently Guy fixed abort() so it will *really* not infinitely recurse trying to print a message, using a lock, causing a new abort, ad infinitum. Unfortunately, that didn't fix one remaining case: DUMMY_HANDLER (see exceptions.cc) used the idiom debug(....); abort(); which can again cause infinite recursion - a #GP calls debug() which causes a new #GP, which again calls debug, etc. Instead of the above broken idiom, created a new function abort(msg), which is just like the familiar abort(), just changes the "Aborted" message to some other message (a constant string). Like abort(), the new variant abort(msg) will only print the message once even if called recursively - and uses a lockless version of debug(). Note that the new abort(msg) is a C++-only API. C will only see the abort(void) which is extern "C". At first I wanted to call the new function panic(msg) and export it to C, but gave when I saw the name panic() was already in use in a bunch of BSD code.
Nadav Har'El authoredRecently Guy fixed abort() so it will *really* not infinitely recurse trying to print a message, using a lock, causing a new abort, ad infinitum. Unfortunately, that didn't fix one remaining case: DUMMY_HANDLER (see exceptions.cc) used the idiom debug(....); abort(); which can again cause infinite recursion - a #GP calls debug() which causes a new #GP, which again calls debug, etc. Instead of the above broken idiom, created a new function abort(msg), which is just like the familiar abort(), just changes the "Aborted" message to some other message (a constant string). Like abort(), the new variant abort(msg) will only print the message once even if called recursively - and uses a lockless version of debug(). Note that the new abort(msg) is a C++-only API. C will only see the abort(void) which is extern "C". At first I wanted to call the new function panic(msg) and export it to C, but gave when I saw the name panic() was already in use in a bunch of BSD code.