Skip to content

Commit f077572

Browse files
georgthegreatblinkov
authored andcommitted
libcxxrt: Invert the condition to match the layout from PR #41
commit_hash:8b75d3afba93f8213cc48d6469c3a908f8084689
1 parent 5fab5fe commit f077572

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

contrib/libs/cxxsupp/libcxxrt/exception.cc

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -316,35 +316,33 @@ static void bt_terminate_handler() {
316316
__cxa_eh_globals* globals = __cxa_get_globals();
317317
__cxa_exception* thrown_exception = globals->caughtExceptions;
318318

319-
if (!thrown_exception) {
320-
abort();
321-
}
322-
323-
fprintf(stderr, "uncaught exception:\n address -> %p\n", (void*)thrown_exception);
324-
thrown_exception = realExceptionFromException(thrown_exception);
319+
if (thrown_exception) {
320+
fprintf(stderr, "uncaught exception:\n address -> %p\n", (void*)thrown_exception);
321+
thrown_exception = realExceptionFromException(thrown_exception);
325322

326-
const __class_type_info *e_ti = static_cast<const __class_type_info*>(&typeid(std::exception));
327-
const __class_type_info *throw_ti = dynamic_cast<const __class_type_info*>(thrown_exception->exceptionType);
323+
const __class_type_info *e_ti = static_cast<const __class_type_info*>(&typeid(std::exception));
324+
const __class_type_info *throw_ti = dynamic_cast<const __class_type_info*>(thrown_exception->exceptionType);
328325

329-
if (throw_ti) {
330-
void* ptr = thrown_exception + 1;
326+
if (throw_ti) {
327+
void* ptr = thrown_exception + 1;
331328

332-
if (throw_ti->__do_upcast(e_ti, &ptr)) {
333-
std::exception* e = static_cast<std::exception*>(ptr);
329+
if (throw_ti->__do_upcast(e_ti, &ptr)) {
330+
std::exception* e = static_cast<std::exception*>(ptr);
334331

335-
if (e) {
336-
fprintf(stderr, " what() -> \"%s\"\n", e->what());
337-
}
338-
}
339-
}
332+
if (e) {
333+
fprintf(stderr, " what() -> \"%s\"\n", e->what());
334+
}
335+
}
336+
}
340337

341-
size_t bufferSize = 128;
342-
char *demangled = static_cast<char*>(malloc(bufferSize));
343-
const char *mangled = thrown_exception->exceptionType->name();
344-
int status;
345-
demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);
346-
fprintf(stderr, " type -> %s\n", status == 0 ? demangled : mangled);
347-
if (status == 0) { free(demangled); }
338+
size_t bufferSize = 128;
339+
char *demangled = static_cast<char*>(malloc(bufferSize));
340+
const char *mangled = thrown_exception->exceptionType->name();
341+
int status;
342+
demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);
343+
fprintf(stderr, " type -> %s\n", status == 0 ? demangled : mangled);
344+
if (status == 0) { free(demangled); }
345+
}
348346
abort();
349347
}
350348

0 commit comments

Comments
 (0)