forked from msizanoen/libunwind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libunwind-8.0.1.patch
63 lines (60 loc) · 1.84 KB
/
libunwind-8.0.1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff --git a/include/wasmer_armehabi_unwind.hpp b/include/wasmer_armehabi_unwind.hpp
new file mode 100644
index 0000000..0920a21
--- /dev/null
+++ b/include/wasmer_armehabi_unwind.hpp
@@ -0,0 +1,6 @@
+void wasmer_unwind_armehabi_register(
+ void *text_begin, size_t text_size,
+ void *axidx_begin, size_t axidx_size
+);
+
+void wasmer_unwind_armehabi_deregister(void *text_begin);
diff --git a/src/AddressSpace.hpp b/src/AddressSpace.hpp
index 2c9a083..c16162b 100644
--- a/src/AddressSpace.hpp
+++ b/src/AddressSpace.hpp
@@ -45,6 +45,28 @@ namespace libunwind {
#include "EHHeaderParser.hpp"
#include "Registers.hpp"
+#ifdef _LIBUNWIND_ARM_EHABI
+#include "wasmer_armehabi_unwind.hpp"
+
+static uintptr_t wasmer_text_base = 0;
+static uintptr_t wasmer_text_end = 0;
+static uintptr_t wasmer_axidx_base = 0;
+static uintptr_t wasmer_axidx_end = 0;
+
+void wasmer_unwind_armehabi_register(
+ void *text_begin, size_t text_size,
+ void *axidx_begin, size_t axidx_size
+) {
+ wasmer_text_base = (uintptr_t)text_begin;
+ wasmer_axidx_base = (uintptr_t)axidx_begin;
+ wasmer_text_end = wasmer_text_base + static_cast<uintptr_t>(text_size);
+ wasmer_axidx_end = wasmer_axidx_base + static_cast<uintptr_t>(axidx_size);
+}
+
+void wasmer_unwind_armehabi_deregister(void *text_begin) {}
+
+#endif
+
#ifdef __APPLE__
struct dyld_unwind_sections
@@ -571,7 +593,16 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
#endif
},
&cb_data);
- return static_cast<bool>(found);
+ //return static_cast<bool>(found);
+ if (found) {
+ return true;
+ } else if (targetAddr >= wasmer_text_base && targetAddr < wasmer_text_end) {
+ info.arm_section = wasmer_axidx_base;
+ info.arm_section_length = wasmer_axidx_end - wasmer_axidx_base;
+ return true;
+ } else {
+ return false;
+ }
#endif
return false;