[libunwind] r280099 - libunwind: fix X86 register numbers for FreeBSD/i386

Ed Maste via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 30 08:10:09 PDT 2016


Author: emaste
Date: Tue Aug 30 10:10:08 2016
New Revision: 280099

URL: http://llvm.org/viewvc/llvm-project?rev=280099&view=rev
Log:
libunwind: fix X86 register numbers for FreeBSD/i386

For historical reasons i386 has ebp and esp swapped in the eh_frame
register numbering on at least Darwin.  That is:

                 Darwin      FreeBSD
        Reg #    eh_frame    eh_frame    DWARF
        =====    ========    ========    =====
          4        ebp         esp        esp
          5        esp         ebp        ebp

Although the UNW_X86_* constants are not intended to be coupled with
DWARF / eh_frame numbering they are currently conflated in libunwind.

Differential Revision:	https://reviews.llvm.org/D22508

Modified:
    libunwind/trunk/include/libunwind.h

Modified: libunwind/trunk/include/libunwind.h
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=280099&r1=280098&r2=280099&view=diff
==============================================================================
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Tue Aug 30 10:10:08 2016
@@ -151,8 +151,13 @@ enum {
   UNW_X86_ECX = 1,
   UNW_X86_EDX = 2,
   UNW_X86_EBX = 3,
+#ifdef __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
 };




More information about the cfe-commits mailing list