summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>2022-06-29 02:43:45 +0300
committerGitHub <noreply@github.com>2022-06-28 19:43:45 -0400
commitcfcf3d193a4425f58ed9556ec54b6d7ab0557330 (patch)
tree04da0e1e3fe3dc3fbdb55f53b0fabbf01e033d82 /include
parent9c7245b97d515c9bdb9f8b63dc1d4e35e2fafa56 (diff)
downloadlibunwind-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')
-rw-r--r--include/remote/elf.h (renamed from include/win/elf.h)9
-rw-r--r--include/remote/endian.h (renamed from include/win/endian.h)10
-rw-r--r--include/remote/freebsd-elf32.h (renamed from include/win/freebsd-elf32.h)0
-rw-r--r--include/remote/freebsd-elf64.h (renamed from include/win/freebsd-elf64.h)0
-rw-r--r--include/remote/freebsd-elf_common.h (renamed from include/win/freebsd-elf_common.h)4
-rw-r--r--include/remote/mac/ucontext.h47
-rw-r--r--include/remote/win/fakestdalign.h.in (renamed from include/win/fakestdalign.h.in)2
-rw-r--r--include/remote/win/fakestdatomic.h.in (renamed from include/win/fakestdatomic.h.in)2
-rw-r--r--include/remote/win/pthread.h (renamed from include/win/pthread.h)0
-rw-r--r--include/remote/win/signal.h (renamed from include/win/signal.h)0
-rw-r--r--include/remote/win/sys/mman.h (renamed from include/win/sys/mman.h)0
-rw-r--r--include/remote/win/sys/stat.h (renamed from include/win/sys/stat.h)0
-rw-r--r--include/remote/win/sys/syscall.h (renamed from include/win/sys/syscall.h)0
-rw-r--r--include/remote/win/sys/types.h (renamed from include/win/sys/types.h)0
-rw-r--r--include/remote/win/sys/ucontext.h (renamed from include/win/sys/ucontext.h)0
-rw-r--r--include/remote/win/ucontext.h (renamed from include/win/ucontext.h)0
-rw-r--r--include/remote/win/unistd.h (renamed from include/win/unistd.h)0
17 files changed, 57 insertions, 17 deletions
diff --git a/include/win/elf.h b/include/remote/elf.h
index 5089ff6b..79193ab4 100644
--- a/include/win/elf.h
+++ b/include/remote/elf.h
@@ -1,11 +1,8 @@
// This is an incomplete & imprecice implementation
// It defers to the open source freebsd-elf implementations.
-// 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
+#ifndef ELF_H
+#define ELF_H
#include <inttypes.h>
@@ -13,4 +10,4 @@
#include "freebsd-elf32.h"
#include "freebsd-elf64.h"
-#endif // _MSC_VER
+#endif // ELF_H
diff --git a/include/win/endian.h b/include/remote/endian.h
index 56fb68a7..6aa6466d 100644
--- a/include/win/endian.h
+++ b/include/remote/endian.h
@@ -1,16 +1,12 @@
// This is an incomplete & imprecice implementation of the
// standard 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
+#ifndef ENDIAN_H
+#define ENDIAN_H
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif // _MSC_VER
+#endif // ENDIAN_H
diff --git a/include/win/freebsd-elf32.h b/include/remote/freebsd-elf32.h
index b4c0d942..b4c0d942 100644
--- a/include/win/freebsd-elf32.h
+++ b/include/remote/freebsd-elf32.h
diff --git a/include/win/freebsd-elf64.h b/include/remote/freebsd-elf64.h
index 0991fe35..0991fe35 100644
--- a/include/win/freebsd-elf64.h
+++ b/include/remote/freebsd-elf64.h
diff --git a/include/win/freebsd-elf_common.h b/include/remote/freebsd-elf_common.h
index 7aef2d49..cc780208 100644
--- a/include/win/freebsd-elf_common.h
+++ b/include/remote/freebsd-elf_common.h
@@ -195,12 +195,12 @@ typedef struct {
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends */
#define SHT_HASH 5 /* symbol hash table section */
-#define SHT_DYNAMIC 6 /* dynamic section */
+#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relocation section - no addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
-#define SHT_DYNSYM 11 /* dynamic symbol table section */
+#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */
#define SHT_FINI_ARRAY 15 /* Termination function pointers. */
#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */
diff --git a/include/remote/mac/ucontext.h b/include/remote/mac/ucontext.h
new file mode 100644
index 00000000..bb09f9cc
--- /dev/null
+++ b/include/remote/mac/ucontext.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2022 Hewlett-Packard Co.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UC_MCONTEXT_GREGS_R8 0x28
+#define UC_MCONTEXT_GREGS_R9 0x30
+#define UC_MCONTEXT_GREGS_R10 0x38
+#define UC_MCONTEXT_GREGS_R11 0x40
+#define UC_MCONTEXT_GREGS_R12 0x48
+#define UC_MCONTEXT_GREGS_R13 0x50
+#define UC_MCONTEXT_GREGS_R14 0x58
+#define UC_MCONTEXT_GREGS_R15 0x60
+#define UC_MCONTEXT_GREGS_RDI 0x68
+#define UC_MCONTEXT_GREGS_RSI 0x70
+#define UC_MCONTEXT_GREGS_RBP 0x78
+#define UC_MCONTEXT_GREGS_RBX 0x80
+#define UC_MCONTEXT_GREGS_RDX 0x88
+#define UC_MCONTEXT_GREGS_RAX 0x90
+#define UC_MCONTEXT_GREGS_RCX 0x98
+#define UC_MCONTEXT_GREGS_RSP 0xa0
+#define UC_MCONTEXT_GREGS_RIP 0xa8
+#define UC_MCONTEXT_FPREGS_PTR 0x1a8
+#define UC_MCONTEXT_FPREGS_MEM 0xe0
+#define UC_SIGMASK 0x128
+#define FPREGS_OFFSET_MXCSR 0x18
+
+#include <sys/ucontext.h>
diff --git a/include/win/fakestdalign.h.in b/include/remote/win/fakestdalign.h.in
index 6eb292c9..3baf6268 100644
--- a/include/win/fakestdalign.h.in
+++ b/include/remote/win/fakestdalign.h.in
@@ -4,6 +4,6 @@
#ifndef FAKE_STD_ALIGN_H
#define FAKE_STD_ALIGN_H
-#define alignas(x)
+#define alignas(x)
#endif // FAKE_STD_ALIGN_H
diff --git a/include/win/fakestdatomic.h.in b/include/remote/win/fakestdatomic.h.in
index 48cde832..799770e8 100644
--- a/include/win/fakestdatomic.h.in
+++ b/include/remote/win/fakestdatomic.h.in
@@ -15,7 +15,7 @@ typedef uint8_t atomic_flag;
#define atomic_compare_and_exchange_strong(x, y, z) return ((*(x) == *(y)) ? ((*(x) = z), true) : ((*(y) = *(x)),false))
-#define atomic_fetch_add(x, y) *(x) += (y), (*(x) - (y))
+#define atomic_fetch_add(x, y) *(x) += (y), (*(x) - (y))
static inline void atomic_flag_clear(volatile atomic_flag* flag)
{
diff --git a/include/win/pthread.h b/include/remote/win/pthread.h
index 8a0b0a18..8a0b0a18 100644
--- a/include/win/pthread.h
+++ b/include/remote/win/pthread.h
diff --git a/include/win/signal.h b/include/remote/win/signal.h
index 48e8e3f9..48e8e3f9 100644
--- a/include/win/signal.h
+++ b/include/remote/win/signal.h
diff --git a/include/win/sys/mman.h b/include/remote/win/sys/mman.h
index 0a3f6f93..0a3f6f93 100644
--- a/include/win/sys/mman.h
+++ b/include/remote/win/sys/mman.h
diff --git a/include/win/sys/stat.h b/include/remote/win/sys/stat.h
index a5b54dea..a5b54dea 100644
--- a/include/win/sys/stat.h
+++ b/include/remote/win/sys/stat.h
diff --git a/include/win/sys/syscall.h b/include/remote/win/sys/syscall.h
index d655d1a8..d655d1a8 100644
--- a/include/win/sys/syscall.h
+++ b/include/remote/win/sys/syscall.h
diff --git a/include/win/sys/types.h b/include/remote/win/sys/types.h
index 7b131f6e..7b131f6e 100644
--- a/include/win/sys/types.h
+++ b/include/remote/win/sys/types.h
diff --git a/include/win/sys/ucontext.h b/include/remote/win/sys/ucontext.h
index c37c3aba..c37c3aba 100644
--- a/include/win/sys/ucontext.h
+++ b/include/remote/win/sys/ucontext.h
diff --git a/include/win/ucontext.h b/include/remote/win/ucontext.h
index fb5aaf73..fb5aaf73 100644
--- a/include/win/ucontext.h
+++ b/include/remote/win/ucontext.h
diff --git a/include/win/unistd.h b/include/remote/win/unistd.h
index d4ff2278..d4ff2278 100644
--- a/include/win/unistd.h
+++ b/include/remote/win/unistd.h