[libunwind] 71fbd6e - Exit unwinding early when at the top of the stack and additional info won't be found.
Sterling Augustine via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 2 10:52:46 PDT 2020
Author: Sterling Augustine
Date: 2020-04-02T10:52:25-07:00
New Revision: 71fbd6e40632f437049215904c28ad9d63cff4bc
URL: https://github.com/llvm/llvm-project/commit/71fbd6e40632f437049215904c28ad9d63cff4bc
DIFF: https://github.com/llvm/llvm-project/commit/71fbd6e40632f437049215904c28ad9d63cff4bc.diff
LOG: Exit unwinding early when at the top of the stack and additional info won't be found.
Summary:
This patch follows libgcc's lead: When the return-address register is
zero, there won't be additional stack frames to examine, or gather
information about. Exit before spending time looking for something
known not to be found.
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77099
Added:
Modified:
libunwind/src/UnwindCursor.hpp
Removed:
################################################################################
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index e7fb70cc5718..32d71c2c1ed3 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -1848,6 +1848,12 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
pc &= (pint_t)~0x1;
#endif
+ // Exit early if at the top of the stack.
+ if (pc == 0) {
+ _unwindInfoMissing = true;
+ return;
+ }
+
// If the last line of a function is a "throw" the compiler sometimes
// emits no instructions after the call to __cxa_throw. This means
// the return address is actually the start of the next function.
More information about the cfe-commits
mailing list