[Lldb-commits] [lldb] r235454 - Same issue as in D8685 but for i386.

Chaoren Lin chaorenl at google.com
Tue Apr 21 16:00:59 PDT 2015


Author: chaoren
Date: Tue Apr 21 18:00:58 2015
New Revision: 235454

URL: http://llvm.org/viewvc/llvm-project?rev=235454&view=rev
Log:
Same issue as in D8685 but for i386.

Modified:
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp?rev=235454&r1=235453&r2=235454&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp Tue Apr 21 18:00:58 2015
@@ -45,6 +45,13 @@ struct dbreg {
                          /* Index 7: debug control */
 };
 
+using FPR_i386 = FXSAVE;
+
+struct UserArea
+{
+    GPR gpr;
+    FPR_i386 i387;
+};
 
 #define DR_SIZE sizeof(uint32_t)
 #define DR_OFFSET(reg_index) \

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp?rev=235454&r1=235453&r2=235454&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Tue Apr 21 18:00:58 2015
@@ -66,7 +66,7 @@ struct UserArea
 {
     GPR      regs;          // General purpose registers.
     int32_t  fpvalid;       // True if FPU is being used.
-    FPR_i386   i387;        // FPU registers.
+    FPR_i386 i387;          // FPU registers.
     uint32_t tsize;         // Text segment size.
     uint32_t dsize;         // Data segment size.
     uint32_t ssize;         // Stack segment size.

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h?rev=235454&r1=235453&r2=235454&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h Tue Apr 21 18:00:58 2015
@@ -18,12 +18,16 @@
 
 // Computes the offset of the given FPR in the extended data area.
 #define FPR_OFFSET(regname)  \
-    (LLVM_EXTENSION offsetof(FPR, xstate) + \
-     LLVM_EXTENSION offsetof(FXSAVE, regname))
+    (LLVM_EXTENSION offsetof(UserArea, i387) + \
+     LLVM_EXTENSION offsetof(FPR_i386, regname))
 
 // Computes the offset of the YMM register assembled from register halves.
-#define YMM_OFFSET(regname) \
-    (LLVM_EXTENSION offsetof(YMM, regname))
+// Based on DNBArchImplI386.cpp from debugserver
+#define YMM_OFFSET(reg_index) \
+    (LLVM_EXTENSION offsetof(UserArea, i387) + \
+     LLVM_EXTENSION offsetof(FPR, xstate) + \
+     LLVM_EXTENSION offsetof(FXSAVE, xmm[7]) + \
+     sizeof(XMMReg) + (32 * reg_index))
 
 // Number of bytes needed to represent a FPR.
 #if !defined(FPR_SIZE)
@@ -70,7 +74,7 @@
 
 // I believe the YMM registers use dwarf_xmm_%_i386 register numbers and then differentiate based on register size.
 #define DEFINE_YMM(reg, i)                                         \
-    { #reg#i, NULL, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(reg[i]),   \
+    { #reg#i, NULL, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(i),        \
       eEncodingVector, eFormatVectorOfUInt8,                       \
       { LLDB_INVALID_REGNUM, dwarf_xmm##i##_i386, LLDB_INVALID_REGNUM, gdb_##reg##i##h_i386, lldb_##reg##i##_i386 }, \
       NULL, NULL }

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h?rev=235454&r1=235453&r2=235454&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h Tue Apr 21 18:00:58 2015
@@ -21,10 +21,11 @@
      LLVM_EXTENSION offsetof(FXSAVE, regname))
 
 // Computes the offset of the YMM register assembled from register halves.
+// Based on DNBArchImplX86_64.cpp from debugserver
 #define YMM_OFFSET(reg_index) \
     (LLVM_EXTENSION offsetof(UserArea, fpr) + \
      LLVM_EXTENSION offsetof(FPR, xstate) + \
-     LLVM_EXTENSION offsetof(XSAVE, ymmh[reg_index]) + \
+     LLVM_EXTENSION offsetof(XSAVE, ymmh[0]) + \
      (32 * reg_index))
 
 #ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT





More information about the lldb-commits mailing list