Skip to content

Commit

Permalink
fix: remove incorrectly described error and clang alternate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed May 19, 2023
1 parent 60adc71 commit 6424d78
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions src/stacktraces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,9 @@ static std::map<void*, std::shared_ptr<std::vector<uint64_t>>> g_stacktraces;

#if CRASH_HOOKS_WRAPPED_CXX_ABI
// These come in through -Wl,-wrap
// It only works on GCC
extern "C" void* __real___cxa_allocate_exception(size_t thrown_size);
extern "C" void __real___cxa_free_exception(void * thrown_exception);
#if __clang__
#error not supported on WIN32 (no dlsym support)
#elif WIN32
#if WIN32
extern "C" void __real__assert(const char *assertion, const char *file, unsigned int line);
extern "C" void __real__wassert(const wchar_t *assertion, const wchar_t *file, unsigned int line);
#else
Expand All @@ -560,13 +557,7 @@ extern "C" void __real___cxa_free_exception(void * thrown_exception)
static auto f = (void(*)(void*))dlsym(RTLD_NEXT, "__cxa_free_exception");
return f(thrown_exception);
}
#if __clang__
extern "C" void __attribute__((noreturn)) __real___assert_rtn(const char *function, const char *file, int line, const char *assertion)
{
static auto f = (void(__attribute__((noreturn)) *) (const char*, const char*, int, const char*))dlsym(RTLD_NEXT, "__assert_rtn");
f(function, file, line, assertion);
}
#elif WIN32
#if WIN32
#error not supported on WIN32 (no dlsym support)
#else
extern "C" void __real___assert_fail(const char *assertion, const char *file, unsigned int line, const char *function)
Expand Down Expand Up @@ -625,15 +616,7 @@ static __attribute__((noinline)) crash_info GetCrashInfoFromAssertion(const char
return ci;
}

#if __clang__
extern "C" void __attribute__((noinline)) WRAPPED_NAME(__assert_rtn)(const char *function, const char *file, int line, const char *assertion)
{
auto ci = GetCrashInfoFromAssertion(assertion, file, line, function);
PrintCrashInfo(ci);
skipAbortSignal = true;
__real___assert_rtn(function, file, line, assertion);
}
#elif WIN32
#if WIN32
extern "C" void __attribute__((noinline)) WRAPPED_NAME(_assert)(const char *assertion, const char *file, unsigned int line)
{
auto ci = GetCrashInfoFromAssertion(assertion, file, line, nullptr);
Expand Down

0 comments on commit 6424d78

Please sign in to comment.