@@ -472,9 +472,7 @@ class _LIBUNWIND_HIDDEN AbstractUnwindCursor {
472472 virtual void getInfo (unw_proc_info_t *) {
473473 _LIBUNWIND_ABORT (" getInfo not implemented" );
474474 }
475- _LIBUNWIND_TRACE_NO_INLINE virtual void jumpto () {
476- _LIBUNWIND_ABORT (" jumpto not implemented" );
477- }
475+ virtual void jumpto () { _LIBUNWIND_ABORT (" jumpto not implemented" ); }
478476 virtual bool isSignalFrame () {
479477 _LIBUNWIND_ABORT (" isSignalFrame not implemented" );
480478 }
@@ -491,12 +489,6 @@ class _LIBUNWIND_HIDDEN AbstractUnwindCursor {
491489 virtual void saveVFPAsX () { _LIBUNWIND_ABORT (" saveVFPAsX not implemented" ); }
492490#endif
493491
494- #ifdef _LIBUNWIND_TRACE_RET_INJECT
495- virtual void setWalkedFrames (unsigned ) {
496- _LIBUNWIND_ABORT (" setWalkedFrames not implemented" );
497- }
498- #endif
499-
500492#ifdef _AIX
501493 virtual uintptr_t getDataRelBase () {
502494 _LIBUNWIND_ABORT (" getDataRelBase not implemented" );
@@ -973,8 +965,7 @@ class UnwindCursor : public AbstractUnwindCursor{
973965 virtual void setFloatReg (int , unw_fpreg_t );
974966 virtual int step (bool stage2 = false );
975967 virtual void getInfo (unw_proc_info_t *);
976- _LIBUNWIND_TRACE_NO_INLINE
977- virtual void jumpto ();
968+ virtual void jumpto ();
978969 virtual bool isSignalFrame ();
979970 virtual bool getFunctionName (char *buf, size_t len, unw_word_t *off);
980971 virtual void setInfoBasedOnIPRegister (bool isReturnAddress = false );
@@ -983,10 +974,6 @@ class UnwindCursor : public AbstractUnwindCursor{
983974 virtual void saveVFPAsX ();
984975#endif
985976
986- #ifdef _LIBUNWIND_TRACE_RET_INJECT
987- virtual void setWalkedFrames (unsigned );
988- #endif
989-
990977#ifdef _AIX
991978 virtual uintptr_t getDataRelBase ();
992979#endif
@@ -1369,9 +1356,6 @@ class UnwindCursor : public AbstractUnwindCursor{
13691356 defined (_LIBUNWIND_TARGET_HAIKU)
13701357 bool _isSigReturn = false;
13711358#endif
1372- #ifdef _LIBUNWIND_TRACE_RET_INJECT
1373- uint32_t _walkedFrames;
1374- #endif
13751359};
13761360
13771361
@@ -1426,46 +1410,7 @@ void UnwindCursor<A, R>::setFloatReg(int regNum, unw_fpreg_t value) {
14261410}
14271411
14281412template <typename A, typename R> void UnwindCursor<A, R>::jumpto() {
1429- #ifdef _LIBUNWIND_TRACE_RET_INJECT
1430- /*
1431-
1432- The value of `_walkedFrames` is computed in `unwind_phase2` and represents the
1433- number of frames walked starting `unwind_phase2` to get to the landing pad.
1434-
1435- ```
1436- // uc is initialized by __unw_getcontext in the parent frame.
1437- // The first stack frame walked is unwind_phase2.
1438- unsigned framesWalked = 1;
1439- ```
1440-
1441- To that, we need to add the number of function calls in libunwind between
1442- `unwind_phase2` & `__libunwind_Registers_arm64_jumpto` which performs the long
1443- jump, to rebalance the execution flow.
1444-
1445- ```
1446- frame #0: libunwind.1.dylib`__libunwind_Registers_arm64_jumpto at UnwindRegistersRestore.S:646
1447- frame #1: libunwind.1.dylib`libunwind::Registers_arm64::returnto at Registers.hpp:2291:3
1448- frame #2: libunwind.1.dylib`libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_arm64>::jumpto at UnwindCursor.hpp:1474:14
1449- frame #3: libunwind.1.dylib`__unw_resume at libunwind.cpp:375:7
1450- frame #4: libunwind.1.dylib`__unw_resume_with_frames_walked at libunwind.cpp:363:10
1451- frame #5: libunwind.1.dylib`unwind_phase2 at UnwindLevel1.c:328:9
1452- frame #6: libunwind.1.dylib`_Unwind_RaiseException at UnwindLevel1.c:480:10
1453- frame #7: libc++abi.dylib`__cxa_throw at cxa_exception.cpp:295:5
1454- ...
1455- ```
1456-
1457- If we look at the backtrace from `__libunwind_Registers_arm64_jumpto`, we see
1458- there are 5 frames on the stack to reach `unwind_phase2`. However, only 4 of
1459- them will never return, since `__libunwind_Registers_arm64_jumpto` returns
1460- back to the landing pad, so we need to subtract 1 to the number of
1461- `_EXTRA_LIBUNWIND_FRAMES_WALKED`.
1462- */
1463-
1464- static constexpr size_t _EXTRA_LIBUNWIND_FRAMES_WALKED = 5 - 1 ;
1465- _registers.returnto (_walkedFrames + _EXTRA_LIBUNWIND_FRAMES_WALKED);
1466- #else
14671413 _registers.jumpto ();
1468- #endif
14691414}
14701415
14711416#ifdef __arm__
@@ -1474,13 +1419,6 @@ template <typename A, typename R> void UnwindCursor<A, R>::saveVFPAsX() {
14741419}
14751420#endif
14761421
1477- #ifdef _LIBUNWIND_TRACE_RET_INJECT
1478- template <typename A, typename R>
1479- void UnwindCursor<A, R>::setWalkedFrames(unsigned walkedFrames) {
1480- _walkedFrames = walkedFrames;
1481- }
1482- #endif
1483-
14841422#ifdef _AIX
14851423template <typename A, typename R>
14861424uintptr_t UnwindCursor<A, R>::getDataRelBase() {
0 commit comments