diff --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h index 9d72d48d206a..fef72bfdc9ee 100644 --- a/libunwind/include/libunwind.h +++ b/libunwind/include/libunwind.h @@ -165,13 +165,8 @@ enum { UNW_X86_ECX = 1, UNW_X86_EDX = 2, UNW_X86_EBX = 3, -#if defined(__CloudABI__) || defined(__FreeBSD__) - UNW_X86_ESP = 4, - UNW_X86_EBP = 5, -#else UNW_X86_EBP = 4, UNW_X86_ESP = 5, -#endif UNW_X86_ESI = 6, UNW_X86_EDI = 7 }; diff --git a/libunwind/src/Registers.hpp b/libunwind/src/Registers.hpp index 8066b808c637..ff57c6076fe0 100644 --- a/libunwind/src/Registers.hpp +++ b/libunwind/src/Registers.hpp @@ -122,9 +122,17 @@ inline uint32_t Registers_x86::getRegister(int regNum) const { return _registers.__edx; case UNW_X86_EBX: return _registers.__ebx; - case UNW_X86_EBP: - return _registers.__ebp; +#if !defined(__APPLE__) case UNW_X86_ESP: +#else + case UNW_X86_EBP: +#endif + return _registers.__ebp; +#if !defined(__APPLE__) + case UNW_X86_EBP: +#else + case UNW_X86_ESP: +#endif return _registers.__esp; case UNW_X86_ESI: return _registers.__esi; @@ -154,10 +162,18 @@ inline void Registers_x86::setRegister(int regNum, uint32_t value) { case UNW_X86_EBX: _registers.__ebx = value; return; +#if !defined(__APPLE__) + case UNW_X86_ESP: +#else case UNW_X86_EBP: +#endif _registers.__ebp = value; return; +#if !defined(__APPLE__) + case UNW_X86_EBP: +#else case UNW_X86_ESP: +#endif _registers.__esp = value; return; case UNW_X86_ESI: