diff options
author | Adeel Mujahid <3840695+am11@users.noreply.github.com> | 2022-06-29 02:43:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 19:43:45 -0400 |
commit | cfcf3d193a4425f58ed9556ec54b6d7ab0557330 (patch) | |
tree | 04da0e1e3fe3dc3fbdb55f53b0fabbf01e033d82 /include/remote/win/sys/ucontext.h | |
parent | 9c7245b97d515c9bdb9f8b63dc1d4e35e2fafa56 (diff) | |
download | libunwind-cfcf3d193a4425f58ed9556ec54b6d7ab0557330.tar.gz |
Add remote unwinding support for macOS (#365)
* Add remote unwinding support for macOS
* Fix broken Win build by bumping minimum language requirement to C11
* Update license headers
* Rename remote_unwind to remote
* Revert Gparser.c
Diffstat (limited to 'include/remote/win/sys/ucontext.h')
-rw-r--r-- | include/remote/win/sys/ucontext.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/remote/win/sys/ucontext.h b/include/remote/win/sys/ucontext.h new file mode 100644 index 00000000..c37c3aba --- /dev/null +++ b/include/remote/win/sys/ucontext.h @@ -0,0 +1,42 @@ +// This is an incomplete & imprecice implementation of the *nix file +// by the same name + + +// Since this is only intended for VC++ compilers +// use #pragma once instead of guard macros +#pragma once + +#ifdef _MSC_VER // Only for cross compilation to windows +#include <inttypes.h> + +#if defined(__linux__) && defined(__x86_64__) +# define SIZEOF_UCONTEXT 936 +#elif defined(__linux__) && defined(__aarch64__) +# define SIZEOF_UCONTEXT 4560 +#elif defined(__linux__) && defined(__arm__) +# define SIZEOF_UCONTEXT 744 +#elif !defined(SIZEOF_UCONTEXT) + // It is not clear whether the sizeof(ucontext_t) is important + // While compiling on Windows the members are not referenced... + // However the size maybe important during a case or a memcpy + // Barring a full audit it could be important so require the size to be defined +# error SIZEOF_UCONTEXT is unknown for this target +#endif + +typedef struct ucontext +{ + uint8_t content[SIZEOF_UCONTEXT]; +} ucontext_t; + +#ifdef __aarch64__ +// These types are used in the definition of the aarch64 unw_tdep_context_t +// They are not used in UNW_REMOTE_ONLY, so typedef them as something +typedef long sigset_t; +typedef long stack_t; + +// Windows SDK defines reserved. It conflicts with arm64 ucontext +// Undefine it +#undef __reserved +#endif + +#endif // _MSC_VER |