[K/N] print thread id in assertion failed
Merge-request: KOTLIN-MR-668 Merged-by: Aleksej Glushko <aleksei.glushko@jetbrains.com>
This commit is contained in:
committed by
Space Cloud
parent
cfd363e232
commit
8173091fee
@@ -17,10 +17,27 @@ using namespace kotlin;
|
||||
|
||||
namespace {
|
||||
|
||||
THREAD_LOCAL_VARIABLE bool assertionReportInProgress = false;
|
||||
|
||||
void PrintAssert(bool allowStacktrace, const char* location, const char* format, std::va_list args) noexcept {
|
||||
if (assertionReportInProgress) {
|
||||
// WARNING: avoid anything that can assert ar panic here
|
||||
konan::consoleErrorf("An attempt to report an assertion lead to another failure:\n");
|
||||
// now try to print the information we have in the simplest way possible
|
||||
if (location != nullptr) {
|
||||
konan::consoleErrorf("%s: ", location);
|
||||
}
|
||||
// do not bother with format string expansion
|
||||
konan::consoleErrorf("%s\n", format);
|
||||
return;
|
||||
}
|
||||
AutoReset recursionGuard(&assertionReportInProgress, true);
|
||||
|
||||
std::array<char, 1024> bufferStorage;
|
||||
std_support::span<char> buffer(bufferStorage);
|
||||
|
||||
buffer = FormatToSpan(buffer, "[tid#%d] ", konan::currentThreadId());
|
||||
|
||||
// Write the title with a source location.
|
||||
if (location != nullptr) {
|
||||
buffer = FormatToSpan(buffer, "%s: runtime assert: ", location);
|
||||
|
||||
Reference in New Issue
Block a user