Skip to content

Commit

Permalink
Fixes for mingw builds (+ ARM64) (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due authored Feb 4, 2023
1 parent a11a107 commit 3d75dc6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:
Expand Down
2 changes: 1 addition & 1 deletion src/backends/sentry_backend_crashpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/sentry_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions src/unwinder/sentry_unwinder_dbghelp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3d75dc6

Please sign in to comment.