[libunwind] 5831adb - Revert "[libunwind] Support for leaf function unwinding."
Daniel Kiss via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 18 02:38:18 PDT 2020
Author: Daniel Kiss
Date: 2020-09-18T11:37:54+02:00
New Revision: 5831adb8c38f3fd1b17ff52984c514fc32e893f6
URL: https://github.com/llvm/llvm-project/commit/5831adb8c38f3fd1b17ff52984c514fc32e893f6
DIFF: https://github.com/llvm/llvm-project/commit/5831adb8c38f3fd1b17ff52984c514fc32e893f6.diff
LOG: Revert "[libunwind] Support for leaf function unwinding."
This reverts commit 23bef7ee9923b1262326981960397e8cd95d6923.
Added:
Modified:
libunwind/src/DwarfInstructions.hpp
libunwind/src/DwarfParser.hpp
libunwind/test/lit.site.cfg.in
Removed:
libunwind/test/signal_unwind.pass.cpp
libunwind/test/unwind_leaffunction.pass.cpp
################################################################################
diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp
index c39cabe1f783..ee98f538d437 100644
--- a/libunwind/src/DwarfInstructions.hpp
+++ b/libunwind/src/DwarfInstructions.hpp
@@ -93,8 +93,7 @@ typename A::pint_t DwarfInstructions<A, R>::getSavedRegister(
case CFI_Parser<A>::kRegisterInRegister:
return registers.getRegister((int)savedReg.value);
- case CFI_Parser<A>::kRegisterUndefined:
- return 0;
+
case CFI_Parser<A>::kRegisterUnused:
case CFI_Parser<A>::kRegisterOffsetFromCFA:
// FIX ME
@@ -118,7 +117,6 @@ double DwarfInstructions<A, R>::getSavedFloatRegister(
case CFI_Parser<A>::kRegisterIsExpression:
case CFI_Parser<A>::kRegisterUnused:
- case CFI_Parser<A>::kRegisterUndefined:
case CFI_Parser<A>::kRegisterOffsetFromCFA:
case CFI_Parser<A>::kRegisterInRegister:
// FIX ME
@@ -142,7 +140,6 @@ v128 DwarfInstructions<A, R>::getSavedVectorRegister(
case CFI_Parser<A>::kRegisterIsExpression:
case CFI_Parser<A>::kRegisterUnused:
- case CFI_Parser<A>::kRegisterUndefined:
case CFI_Parser<A>::kRegisterOffsetFromCFA:
case CFI_Parser<A>::kRegisterInRegister:
// FIX ME
@@ -193,10 +190,6 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc,
prolog.savedRegisters[i]));
else
return UNW_EBADREG;
- } else if (i == (int)cieInfo.returnAddressRegister) {
- // Leaf function keeps the return address in register and there is no
- // explicit intructions how to restore it.
- returnAddress = registers.getRegister(cieInfo.returnAddressRegister);
}
}
diff --git a/libunwind/src/DwarfParser.hpp b/libunwind/src/DwarfParser.hpp
index 86c0522afd3f..fb943edfdb7e 100644
--- a/libunwind/src/DwarfParser.hpp
+++ b/libunwind/src/DwarfParser.hpp
@@ -69,7 +69,6 @@ class CFI_Parser {
};
enum RegisterSavedWhere {
kRegisterUnused,
- kRegisterUndefined,
kRegisterInCFA,
kRegisterOffsetFromCFA,
kRegisterInRegister,
@@ -506,7 +505,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
"malformed DW_CFA_undefined DWARF unwind, reg too big");
return false;
}
- results->setRegisterLocation(reg, kRegisterUndefined, initialState);
+ results->setRegisterLocation(reg, kRegisterUnused, initialState);
_LIBUNWIND_TRACE_DWARF("DW_CFA_undefined(reg=%" PRIu64 ")\n", reg);
break;
case DW_CFA_same_value:
diff --git a/libunwind/test/lit.site.cfg.in b/libunwind/test/lit.site.cfg.in
index 84dae3c2bfb0..8ff770fe29bc 100644
--- a/libunwind/test/lit.site.cfg.in
+++ b/libunwind/test/lit.site.cfg.in
@@ -44,10 +44,6 @@ config.test_source_root = os.path.join(config.libunwind_src_root, 'test')
# Allow expanding substitutions that are based on other substitutions
config.recursiveExpansionLimit = 10
-# Make symbols available in the tests.
-config.test_compiler_flags += " -funwind-tables "
-config.test_linker_flags += " -Wl,--export-dynamic "
-
# Infer the test_exec_root from the build directory.
config.test_exec_root = os.path.join(config.libunwind_obj_root, 'test')
diff --git a/libunwind/test/signal_unwind.pass.cpp b/libunwind/test/signal_unwind.pass.cpp
deleted file mode 100644
index 295dd75bb726..000000000000
--- a/libunwind/test/signal_unwind.pass.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// Ensure that the unwinder can cope with the signal handler.
-
-#include <assert.h>
-#include <dlfcn.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <unwind.h>
-
-_Unwind_Reason_Code frame_handler(struct _Unwind_Context* ctx, void* arg) {
- (void)arg;
- Dl_info info = { 0, 0, 0, 0 };
- assert(dladdr((void*)_Unwind_GetIP(ctx), &info));
-
- // Unwind util the main is reached, above frames deeped on the platfrom and architecture.
- if(info.dli_sname && !strcmp("main", info.dli_sname)) {
- _Exit(0);
- }
- return _URC_NO_REASON;
-}
-
-void signal_handler(int signum) {
- (void)signum;
- _Unwind_Backtrace(frame_handler, NULL);
- _Exit(-1);
-}
-
-int main() {
- signal(SIGUSR1, signal_handler);
- kill(getpid(), SIGUSR1);
- return -2;
-}
diff --git a/libunwind/test/unwind_leaffunction.pass.cpp b/libunwind/test/unwind_leaffunction.pass.cpp
deleted file mode 100644
index b8a114516d0a..000000000000
--- a/libunwind/test/unwind_leaffunction.pass.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// Ensure that leaf function can be unwund.
-
-#include <assert.h>
-#include <dlfcn.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <unwind.h>
-
-_Unwind_Reason_Code frame_handler(struct _Unwind_Context* ctx, void* arg) {
- (void)arg;
- Dl_info info = { 0, 0, 0, 0 };
- assert(dladdr((void*)_Unwind_GetIP(ctx), &info));
-
- // Unwind util the main is reached, above frames deeped on the platfrom and architecture.
- if(info.dli_sname && !strcmp("main", info.dli_sname)) {
- _Exit(0);
- }
- return _URC_NO_REASON;
-}
-
-void signal_handler(int signum) {
- (void)signum;
- _Unwind_Backtrace(frame_handler, NULL);
- _Exit(-1);
-}
-
-int* faultyPointer = NULL;
-
-__attribute__((noinline)) void crashing_leaf_func(void) {
- *faultyPointer = 0;
-}
-
-int main() {
- signal(SIGSEGV, signal_handler);
- crashing_leaf_func();
- return -2;
-}
\ No newline at end of file
More information about the cfe-commits
mailing list