aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c')
-rw-r--r--contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c134
1 files changed, 67 insertions, 67 deletions
diff --git a/contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c b/contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c
index 951d5d219a..8959f8ed66 100644
--- a/contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c
+++ b/contrib/libs/libunwind/src/UnwindLevel1-gcc-ext.c
@@ -1,8 +1,8 @@
//===----------------------------------------------------------------------===//
//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
// Implements gcc extensions to the C++ ABI Exception Handling Level 1.
@@ -22,16 +22,16 @@
#include "Unwind-EHABI.h"
#include "unwind.h"
-#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
+#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
-#if defined(_LIBUNWIND_SUPPORT_SEH_UNWIND)
+#if defined(_LIBUNWIND_SUPPORT_SEH_UNWIND)
#define PRIVATE_1 private_[0]
#elif defined(_LIBUNWIND_ARM_EHABI)
#define PRIVATE_1 unwinder_cache.reserved1
#else
#define PRIVATE_1 private_1
-#endif
-
+#endif
+
/// Called by __cxa_rethrow().
_LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
@@ -60,7 +60,7 @@ _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
_LIBUNWIND_EXPORT uintptr_t
_Unwind_GetDataRelBase(struct _Unwind_Context *context) {
(void)context;
- _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)", (void *)context);
+ _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)", (void *)context);
_LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented");
}
@@ -70,7 +70,7 @@ _Unwind_GetDataRelBase(struct _Unwind_Context *context) {
_LIBUNWIND_EXPORT uintptr_t
_Unwind_GetTextRelBase(struct _Unwind_Context *context) {
(void)context;
- _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)", (void *)context);
+ _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)", (void *)context);
_LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented");
}
@@ -78,17 +78,17 @@ _Unwind_GetTextRelBase(struct _Unwind_Context *context) {
/// Scans unwind information to find the function that contains the
/// specified code address "pc".
_LIBUNWIND_EXPORT void *_Unwind_FindEnclosingFunction(void *pc) {
- _LIBUNWIND_TRACE_API("_Unwind_FindEnclosingFunction(pc=%p)", pc);
+ _LIBUNWIND_TRACE_API("_Unwind_FindEnclosingFunction(pc=%p)", pc);
// This is slow, but works.
// We create an unwind cursor then alter the IP to be pc
unw_cursor_t cursor;
unw_context_t uc;
unw_proc_info_t info;
- __unw_getcontext(&uc);
- __unw_init_local(&cursor, &uc);
- __unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t)pc);
- if (__unw_get_proc_info(&cursor, &info) == UNW_ESUCCESS)
- return (void *)(intptr_t) info.start_ip;
+ __unw_getcontext(&uc);
+ __unw_init_local(&cursor, &uc);
+ __unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t)pc);
+ if (__unw_get_proc_info(&cursor, &info) == UNW_ESUCCESS)
+ return (void *)(intptr_t) info.start_ip;
else
return NULL;
}
@@ -99,13 +99,13 @@ _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
unw_cursor_t cursor;
unw_context_t uc;
- __unw_getcontext(&uc);
- __unw_init_local(&cursor, &uc);
+ __unw_getcontext(&uc);
+ __unw_init_local(&cursor, &uc);
- _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)",
+ _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)",
(void *)(uintptr_t)callback);
-#if defined(_LIBUNWIND_ARM_EHABI)
+#if defined(_LIBUNWIND_ARM_EHABI)
// Create a mock exception object for force unwinding.
_Unwind_Exception ex;
memset(&ex, '\0', sizeof(ex));
@@ -116,19 +116,19 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
while (true) {
_Unwind_Reason_Code result;
-#if !defined(_LIBUNWIND_ARM_EHABI)
- // ask libunwind to get next frame (skip over first frame which is
+#if !defined(_LIBUNWIND_ARM_EHABI)
+ // ask libunwind to get next frame (skip over first frame which is
// _Unwind_Backtrace())
- if (__unw_step(&cursor) <= 0) {
+ if (__unw_step(&cursor) <= 0) {
_LIBUNWIND_TRACE_UNWINDING(" _backtrace: ended because cursor reached "
- "bottom of stack, returning %d",
+ "bottom of stack, returning %d",
_URC_END_OF_STACK);
return _URC_END_OF_STACK;
}
#else
// Get the information for this frame.
unw_proc_info_t frameInfo;
- if (__unw_get_proc_info(&cursor, &frameInfo) != UNW_ESUCCESS) {
+ if (__unw_get_proc_info(&cursor, &frameInfo) != UNW_ESUCCESS) {
return _URC_END_OF_STACK;
}
@@ -140,7 +140,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
struct _Unwind_Context *context = (struct _Unwind_Context *)&cursor;
// Get and call the personality function to unwind the frame.
- _Unwind_Personality_Fn handler = (_Unwind_Personality_Fn)frameInfo.handler;
+ _Unwind_Personality_Fn handler = (_Unwind_Personality_Fn)frameInfo.handler;
if (handler == NULL) {
return _URC_END_OF_STACK;
}
@@ -148,18 +148,18 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
_URC_CONTINUE_UNWIND) {
return _URC_END_OF_STACK;
}
-#endif // defined(_LIBUNWIND_ARM_EHABI)
+#endif // defined(_LIBUNWIND_ARM_EHABI)
// debugging
if (_LIBUNWIND_TRACING_UNWINDING) {
char functionName[512];
unw_proc_info_t frame;
unw_word_t offset;
- __unw_get_proc_name(&cursor, functionName, 512, &offset);
- __unw_get_proc_info(&cursor, &frame);
+ __unw_get_proc_name(&cursor, functionName, 512, &offset);
+ __unw_get_proc_info(&cursor, &frame);
_LIBUNWIND_TRACE_UNWINDING(
- " _backtrace: start_ip=0x%" PRIxPTR ", func=%s, lsda=0x%" PRIxPTR ", context=%p",
- frame.start_ip, functionName, frame.lsda,
+ " _backtrace: start_ip=0x%" PRIxPTR ", func=%s, lsda=0x%" PRIxPTR ", context=%p",
+ frame.start_ip, functionName, frame.lsda,
(void *)&cursor);
}
@@ -167,14 +167,14 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
result = (*callback)((struct _Unwind_Context *)(&cursor), ref);
if (result != _URC_NO_REASON) {
_LIBUNWIND_TRACE_UNWINDING(
- " _backtrace: ended because callback returned %d", result);
+ " _backtrace: ended because callback returned %d", result);
return result;
}
}
}
-/// Find DWARF unwind info for an address 'pc' in some function.
+/// Find DWARF unwind info for an address 'pc' in some function.
_LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc,
struct dwarf_eh_bases *bases) {
// This is slow, but works.
@@ -182,16 +182,16 @@ _LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc,
unw_cursor_t cursor;
unw_context_t uc;
unw_proc_info_t info;
- __unw_getcontext(&uc);
- __unw_init_local(&cursor, &uc);
- __unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t)pc);
- __unw_get_proc_info(&cursor, &info);
+ __unw_getcontext(&uc);
+ __unw_init_local(&cursor, &uc);
+ __unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t)pc);
+ __unw_get_proc_info(&cursor, &info);
bases->tbase = (uintptr_t)info.extra;
bases->dbase = 0; // dbase not used on Mac OS X
bases->func = (uintptr_t)info.start_ip;
- _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p", pc,
- (void *)(intptr_t) info.unwind_info);
- return (void *)(intptr_t) info.unwind_info;
+ _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p", pc,
+ (void *)(intptr_t) info.unwind_info);
+ return (void *)(intptr_t) info.unwind_info;
}
/// Returns the CFA (call frame area, or stack pointer at start of function)
@@ -199,9 +199,9 @@ _LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc,
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) {
unw_cursor_t *cursor = (unw_cursor_t *)context;
unw_word_t result;
- __unw_get_reg(cursor, UNW_REG_SP, &result);
- _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p) => 0x%" PRIxPTR,
- (void *)context, result);
+ __unw_get_reg(cursor, UNW_REG_SP, &result);
+ _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p) => 0x%" PRIxPTR,
+ (void *)context, result);
return (uintptr_t)result;
}
@@ -211,27 +211,27 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) {
/// site address. Normally IP is the return address.
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
int *ipBefore) {
- _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)", (void *)context);
- int isSignalFrame = __unw_is_signal_frame((unw_cursor_t *)context);
- // Negative means some kind of error (probably UNW_ENOINFO), but we have no
- // good way to report that, and this maintains backward compatibility with the
- // implementation that hard-coded zero in every case, even signal frames.
- if (isSignalFrame <= 0)
- *ipBefore = 0;
- else
- *ipBefore = 1;
+ _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)", (void *)context);
+ int isSignalFrame = __unw_is_signal_frame((unw_cursor_t *)context);
+ // Negative means some kind of error (probably UNW_ENOINFO), but we have no
+ // good way to report that, and this maintains backward compatibility with the
+ // implementation that hard-coded zero in every case, even signal frames.
+ if (isSignalFrame <= 0)
+ *ipBefore = 0;
+ else
+ *ipBefore = 1;
return _Unwind_GetIP(context);
}
-#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
+#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
/// Called by programs with dynamic code generators that want
/// to register a dynamically generated FDE.
/// This function has existed on Mac OS X since 10.4, but
/// was broken until 10.6.
_LIBUNWIND_EXPORT void __register_frame(const void *fde) {
- _LIBUNWIND_TRACE_API("__register_frame(%p)", fde);
- __unw_add_dynamic_fde((unw_word_t)(uintptr_t)fde);
+ _LIBUNWIND_TRACE_API("__register_frame(%p)", fde);
+ __unw_add_dynamic_fde((unw_word_t)(uintptr_t)fde);
}
@@ -240,8 +240,8 @@ _LIBUNWIND_EXPORT void __register_frame(const void *fde) {
/// This function has existed on Mac OS X since 10.4, but
/// was broken until 10.6.
_LIBUNWIND_EXPORT void __deregister_frame(const void *fde) {
- _LIBUNWIND_TRACE_API("__deregister_frame(%p)", fde);
- __unw_remove_dynamic_fde((unw_word_t)(uintptr_t)fde);
+ _LIBUNWIND_TRACE_API("__deregister_frame(%p)", fde);
+ __unw_remove_dynamic_fde((unw_word_t)(uintptr_t)fde);
}
@@ -253,14 +253,14 @@ _LIBUNWIND_EXPORT void __deregister_frame(const void *fde) {
// applications working. We also add the not in 10.6 symbol so that nwe
// application won't be able to use them.
-#if defined(_LIBUNWIND_SUPPORT_FRAME_APIS)
+#if defined(_LIBUNWIND_SUPPORT_FRAME_APIS)
_LIBUNWIND_EXPORT void __register_frame_info_bases(const void *fde, void *ob,
void *tb, void *db) {
(void)fde;
(void)ob;
(void)tb;
(void)db;
- _LIBUNWIND_TRACE_API("__register_frame_info_bases(%p,%p, %p, %p)",
+ _LIBUNWIND_TRACE_API("__register_frame_info_bases(%p,%p, %p, %p)",
fde, ob, tb, db);
// do nothing, this function never worked in Mac OS X
}
@@ -268,7 +268,7 @@ _LIBUNWIND_EXPORT void __register_frame_info_bases(const void *fde, void *ob,
_LIBUNWIND_EXPORT void __register_frame_info(const void *fde, void *ob) {
(void)fde;
(void)ob;
- _LIBUNWIND_TRACE_API("__register_frame_info(%p, %p)", fde, ob);
+ _LIBUNWIND_TRACE_API("__register_frame_info(%p, %p)", fde, ob);
// do nothing, this function never worked in Mac OS X
}
@@ -280,38 +280,38 @@ _LIBUNWIND_EXPORT void __register_frame_info_table_bases(const void *fde,
(void)tb;
(void)db;
_LIBUNWIND_TRACE_API("__register_frame_info_table_bases"
- "(%p,%p, %p, %p)", fde, ob, tb, db);
+ "(%p,%p, %p, %p)", fde, ob, tb, db);
// do nothing, this function never worked in Mac OS X
}
_LIBUNWIND_EXPORT void __register_frame_info_table(const void *fde, void *ob) {
(void)fde;
(void)ob;
- _LIBUNWIND_TRACE_API("__register_frame_info_table(%p, %p)", fde, ob);
+ _LIBUNWIND_TRACE_API("__register_frame_info_table(%p, %p)", fde, ob);
// do nothing, this function never worked in Mac OS X
}
_LIBUNWIND_EXPORT void __register_frame_table(const void *fde) {
(void)fde;
- _LIBUNWIND_TRACE_API("__register_frame_table(%p)", fde);
+ _LIBUNWIND_TRACE_API("__register_frame_table(%p)", fde);
// do nothing, this function never worked in Mac OS X
}
_LIBUNWIND_EXPORT void *__deregister_frame_info(const void *fde) {
(void)fde;
- _LIBUNWIND_TRACE_API("__deregister_frame_info(%p)", fde);
+ _LIBUNWIND_TRACE_API("__deregister_frame_info(%p)", fde);
// do nothing, this function never worked in Mac OS X
return NULL;
}
_LIBUNWIND_EXPORT void *__deregister_frame_info_bases(const void *fde) {
(void)fde;
- _LIBUNWIND_TRACE_API("__deregister_frame_info_bases(%p)", fde);
+ _LIBUNWIND_TRACE_API("__deregister_frame_info_bases(%p)", fde);
// do nothing, this function never worked in Mac OS X
return NULL;
}
-#endif // defined(_LIBUNWIND_SUPPORT_FRAME_APIS)
+#endif // defined(_LIBUNWIND_SUPPORT_FRAME_APIS)
-#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
+#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
-#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
+#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)