diff --git a/CHANGELOG.md b/CHANGELOG.md index d77bf17dc..ddc624d93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - A session may be ended with a different status code. ([#801](https://github.com/getsentry/sentry-native/pull/801)) +**Fixes**: + +- Fix various mingw compilation issues ([#794](https://github.com/getsentry/sentry-native/pull/794)) + ## 0.5.4 **Fixes**: diff --git a/src/backends/sentry_backend_crashpad.cpp b/src/backends/sentry_backend_crashpad.cpp index f9f57fc3e..c44672341 100644 --- a/src/backends/sentry_backend_crashpad.cpp +++ b/src/backends/sentry_backend_crashpad.cpp @@ -33,7 +33,7 @@ extern "C" { #include "client/crashpad_info.h" #include "client/prune_crash_reports.h" #include "client/settings.h" -#if defined(_MSC_VER) +#if defined(_WIN32) # include "util/win/termination_codes.h" #endif diff --git a/src/sentry_sync.h b/src/sentry_sync.h index 11915536a..0741c3070 100644 --- a/src/sentry_sync.h +++ b/src/sentry_sync.h @@ -13,7 +13,7 @@ # define THREAD_FUNCTION_API #endif -#if defined(__MINGW32__) && !defined(__MINGW64__) +#if defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__clang__) # define UNSIGNED_MINGW unsigned #else # define UNSIGNED_MINGW diff --git a/src/unwinder/sentry_unwinder_dbghelp.c b/src/unwinder/sentry_unwinder_dbghelp.c index fd6ec3b72..7d22728da 100644 --- a/src/unwinder/sentry_unwinder_dbghelp.c +++ b/src/unwinder/sentry_unwinder_dbghelp.c @@ -43,16 +43,32 @@ sentry__unwind_stack_dbghelp( memset(&stack_frame, 0, sizeof(stack_frame)); size_t size = 0; -#if defined(_WIN64) +#if defined(_M_X64) int machine_type = IMAGE_FILE_MACHINE_AMD64; stack_frame.AddrPC.Offset = ctx.Rip; stack_frame.AddrFrame.Offset = ctx.Rbp; stack_frame.AddrStack.Offset = ctx.Rsp; -#else +#elif defined(_M_IX86) int machine_type = IMAGE_FILE_MACHINE_I386; stack_frame.AddrPC.Offset = ctx.Eip; stack_frame.AddrFrame.Offset = ctx.Ebp; stack_frame.AddrStack.Offset = ctx.Esp; +#elif defined(_M_ARM64) + int machine_type = IMAGE_FILE_MACHINE_ARM64; + stack_frame.AddrPC.Offset = ctx.Pc; +# if defined(NONAMELESSUNION) + stack_frame.AddrFrame.Offset = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp; +# else + stack_frame.AddrFrame.Offset = ctx.Fp; +# endif + stack_frame.AddrStack.Offset = ctx.Sp; +#elif defined(_M_ARM) + int machine_type = IMAGE_FILE_MACHINE_ARM; + stack_frame.AddrPC.Offset = ctx.Pc; + stack_frame.AddrFrame.Offset = ctx.R11; + stack_frame.AddrStack.Offset = ctx.Sp; +#else +# error "Platform not supported!" #endif stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrFrame.Mode = AddrModeFlat;