Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/libs/prx/libc/src/exception/ExceptionPointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ void APS5_VABI _ZNSt13__future_base12_Result_baseD2Ev_nid_postfix(std::__future_
}

void APS5_VABI _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv_nid_postfix(std::exception_ptr* self) noexcept {
if (!self) return;
ExceptionPointerAddref(self);
}

void APS5_VABI _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv_nid_postfix(std::exception_ptr* self) noexcept {
if (!self) return;
ExceptionPointerRelease(self);
}

Expand Down Expand Up @@ -102,11 +104,13 @@ const type_info* exception_ptr::__cxa_exception_type() const noexcept {

extern "C" {
void APS5_VABI _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv_nid_postfix(GuestExceptionPointer* self) noexcept {
if (!self) return;
__cxa_increment_exception_refcount_nid_postfix(self->object);

}

void APS5_VABI _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv_nid_postfix(GuestExceptionPointer* self) noexcept {
if (!self) return;
__cxa_decrement_exception_refcount_nid_postfix(self->object);

self->object = nullptr;
Expand Down
9 changes: 9 additions & 0 deletions core/libs/tests/GuestUnwindAccessors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "prx/libc/include/exceptions/Unwind.hpp"
#include "prx/libc/include/general/VabiMacros.hpp"
#include <array>
#include <cerrno>
#include <cstddef>
#include <cstdint>
#include <cstdio>
Expand Down Expand Up @@ -128,6 +129,13 @@ void CheckExceptionPointerType() {
__cxa_free_exception_nid_postfix(object);
}

void CheckExceptionPointerNullSelf() {
const int savedErrno = errno;
_ZNSt15__exception_ptr13exception_ptr9_M_addrefEv_nid_postfix(nullptr);
_ZNSt15__exception_ptr13exception_ptr10_M_releaseEv_nid_postfix(nullptr);
Check(errno == savedErrno);
}

void CheckArrayNullDealloc() {
for (bool sized : {false, true}) {
ResetVecState();
Expand Down Expand Up @@ -236,6 +244,7 @@ int main() {
for (int index = 0; index < RegisterCount; ++index) Check(_Unwind_GetGR_nid_postfix(&context, index) == 0);
}
CheckExceptionPointerType();
CheckExceptionPointerNullSelf();
CheckArrayNullDealloc();
return 0;
}
Loading