CompactUnwinder.hpp (288151) | CompactUnwinder.hpp (302450) |
---|---|
1//===-------------------------- CompactUnwinder.hpp -----------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8// --- 13 unchanged lines hidden (view full) --- 22#include "AddressSpace.hpp" 23#include "Registers.hpp" 24 25#define EXTRACT_BITS(value, mask) \ 26 ((value >> __builtin_ctz(mask)) & (((1 << __builtin_popcount(mask))) - 1)) 27 28namespace libunwind { 29 | 1//===-------------------------- CompactUnwinder.hpp -----------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8// --- 13 unchanged lines hidden (view full) --- 22#include "AddressSpace.hpp" 23#include "Registers.hpp" 24 25#define EXTRACT_BITS(value, mask) \ 26 ((value >> __builtin_ctz(mask)) & (((1 << __builtin_popcount(mask))) - 1)) 27 28namespace libunwind { 29 |
30#if defined(_LIBUNWIND_TARGET_I386) |
|
30/// CompactUnwinder_x86 uses a compact unwind info to virtually "step" (aka 31/// unwind) by modifying a Registers_x86 register set 32template <typename A> 33class CompactUnwinder_x86 { 34public: 35 36 static int stepWithCompactEncoding(compact_unwind_encoding_t info, 37 uint32_t functionStart, A &addressSpace, --- 212 unchanged lines hidden (view full) --- 250void CompactUnwinder_x86<A>::framelessUnwind( 251 A &addressSpace, typename A::pint_t returnAddressLocation, 252 Registers_x86 ®isters) { 253 // return address is on stack after last saved register 254 registers.setIP(addressSpace.get32(returnAddressLocation)); 255 // old esp is before return address 256 registers.setSP((uint32_t)returnAddressLocation + 4); 257} | 31/// CompactUnwinder_x86 uses a compact unwind info to virtually "step" (aka 32/// unwind) by modifying a Registers_x86 register set 33template <typename A> 34class CompactUnwinder_x86 { 35public: 36 37 static int stepWithCompactEncoding(compact_unwind_encoding_t info, 38 uint32_t functionStart, A &addressSpace, --- 212 unchanged lines hidden (view full) --- 251void CompactUnwinder_x86<A>::framelessUnwind( 252 A &addressSpace, typename A::pint_t returnAddressLocation, 253 Registers_x86 ®isters) { 254 // return address is on stack after last saved register 255 registers.setIP(addressSpace.get32(returnAddressLocation)); 256 // old esp is before return address 257 registers.setSP((uint32_t)returnAddressLocation + 4); 258} |
259#endif // _LIBUNWIND_TARGET_I386 |
|
258 259 | 260 261 |
262#if defined(_LIBUNWIND_TARGET_X86_64) |
|
260/// CompactUnwinder_x86_64 uses a compact unwind info to virtually "step" (aka 261/// unwind) by modifying a Registers_x86_64 register set 262template <typename A> 263class CompactUnwinder_x86_64 { 264public: 265 266 static int stepWithCompactEncoding(compact_unwind_encoding_t compactEncoding, 267 uint64_t functionStart, A &addressSpace, --- 211 unchanged lines hidden (view full) --- 479void CompactUnwinder_x86_64<A>::framelessUnwind(A &addressSpace, 480 uint64_t returnAddressLocation, 481 Registers_x86_64 ®isters) { 482 // return address is on stack after last saved register 483 registers.setIP(addressSpace.get64(returnAddressLocation)); 484 // old esp is before return address 485 registers.setSP(returnAddressLocation + 8); 486} | 263/// CompactUnwinder_x86_64 uses a compact unwind info to virtually "step" (aka 264/// unwind) by modifying a Registers_x86_64 register set 265template <typename A> 266class CompactUnwinder_x86_64 { 267public: 268 269 static int stepWithCompactEncoding(compact_unwind_encoding_t compactEncoding, 270 uint64_t functionStart, A &addressSpace, --- 211 unchanged lines hidden (view full) --- 482void CompactUnwinder_x86_64<A>::framelessUnwind(A &addressSpace, 483 uint64_t returnAddressLocation, 484 Registers_x86_64 ®isters) { 485 // return address is on stack after last saved register 486 registers.setIP(addressSpace.get64(returnAddressLocation)); 487 // old esp is before return address 488 registers.setSP(returnAddressLocation + 8); 489} |
490#endif // _LIBUNWIND_TARGET_X86_64 |
|
487 488 489 | 491 492 493 |
494#if defined(_LIBUNWIND_TARGET_AARCH64) |
|
490/// CompactUnwinder_arm64 uses a compact unwind info to virtually "step" (aka 491/// unwind) by modifying a Registers_arm64 register set 492template <typename A> 493class CompactUnwinder_arm64 { 494public: 495 496 static int stepWithCompactEncoding(compact_unwind_encoding_t compactEncoding, 497 uint64_t functionStart, A &addressSpace, --- 183 unchanged lines hidden (view full) --- 681 registers.setFP(addressSpace.get64(fp)); 682 // old sp is fp less saved fp and lr 683 registers.setSP(fp + 16); 684 // pop return address into pc 685 registers.setIP(addressSpace.get64(fp + 8)); 686 687 return UNW_STEP_SUCCESS; 688} | 495/// CompactUnwinder_arm64 uses a compact unwind info to virtually "step" (aka 496/// unwind) by modifying a Registers_arm64 register set 497template <typename A> 498class CompactUnwinder_arm64 { 499public: 500 501 static int stepWithCompactEncoding(compact_unwind_encoding_t compactEncoding, 502 uint64_t functionStart, A &addressSpace, --- 183 unchanged lines hidden (view full) --- 686 registers.setFP(addressSpace.get64(fp)); 687 // old sp is fp less saved fp and lr 688 registers.setSP(fp + 16); 689 // pop return address into pc 690 registers.setIP(addressSpace.get64(fp + 8)); 691 692 return UNW_STEP_SUCCESS; 693} |
694#endif // _LIBUNWIND_TARGET_AARCH64 |
|
689 690 691} // namespace libunwind 692 693#endif // __COMPACT_UNWINDER_HPP__ | 695 696 697} // namespace libunwind 698 699#endif // __COMPACT_UNWINDER_HPP__ |