aboutsummaryrefslogtreecommitdiff
path: root/lib/libunwind/src/libunwind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libunwind/src/libunwind.cpp')
-rw-r--r--lib/libunwind/src/libunwind.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/lib/libunwind/src/libunwind.cpp b/lib/libunwind/src/libunwind.cpp
index ac01246e86..03f8b75b5b 100644
--- a/lib/libunwind/src/libunwind.cpp
+++ b/lib/libunwind/src/libunwind.cpp
@@ -1,4 +1,4 @@
-//===--------------------------- libunwind.cpp ----------------------------===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,8 +11,8 @@
#include <libunwind.h>
-#include "libunwind_ext.h"
#include "config.h"
+#include "libunwind_ext.h"
#include <stdlib.h>
@@ -30,8 +30,6 @@
#include "AddressSpace.hpp"
#include "UnwindCursor.hpp"
-#pragma clang diagnostic ignored "-Wdll-attribute-on-redeclaration"
-
using namespace libunwind;
/// internal object to represent this processes address space
@@ -53,7 +51,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
# define REGISTER_KIND Registers_x86_64
#elif defined(__powerpc64__)
# define REGISTER_KIND Registers_ppc64
-#elif defined(__ppc__)
+#elif defined(__powerpc__)
# define REGISTER_KIND Registers_ppc
#elif defined(__aarch64__)
# define REGISTER_KIND Registers_arm64
@@ -70,7 +68,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
#elif defined(__mips__)
# warning The MIPS architecture is not supported with this ABI and environment!
#elif defined(__sparc__) && defined(__arch64__)
-# define REGISTER_KIND Registers_sparc64
+#define REGISTER_KIND Registers_sparc64
#elif defined(__sparc__)
# define REGISTER_KIND Registers_sparc
#elif defined(__riscv)
@@ -296,6 +294,35 @@ void __unw_remove_dynamic_fde(unw_word_t fde) {
// fde is own mh_group
DwarfFDECache<LocalAddressSpace>::removeAllIn((LocalAddressSpace::pint_t)fde);
}
+
+void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start) {
+ // The eh_frame section start serves as the mh_group
+ unw_word_t mh_group = eh_frame_start;
+ CFI_Parser<LocalAddressSpace>::CIE_Info cieInfo;
+ CFI_Parser<LocalAddressSpace>::FDE_Info fdeInfo;
+ auto p = (LocalAddressSpace::pint_t)eh_frame_start;
+ while (true) {
+ if (CFI_Parser<LocalAddressSpace>::decodeFDE(
+ LocalAddressSpace::sThisAddressSpace, p, &fdeInfo, &cieInfo,
+ true) == NULL) {
+ DwarfFDECache<LocalAddressSpace>::add((LocalAddressSpace::pint_t)mh_group,
+ fdeInfo.pcStart, fdeInfo.pcEnd,
+ fdeInfo.fdeStart);
+ p += fdeInfo.fdeLength;
+ } else if (CFI_Parser<LocalAddressSpace>::parseCIE(
+ LocalAddressSpace::sThisAddressSpace, p, &cieInfo) == NULL) {
+ p += cieInfo.cieLength;
+ } else
+ return;
+ }
+}
+
+void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) {
+ // The eh_frame section start serves as the mh_group
+ DwarfFDECache<LocalAddressSpace>::removeAllIn(
+ (LocalAddressSpace::pint_t)eh_frame_start);
+}
+
#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
#endif // !defined(__USING_SJLJ_EXCEPTIONS__)