[lldb-dev] 32-bit linux IsWatchpointHit assertion failure due to WriteRegister

Matthew Gardiner mg11 at csr.com
Sun Mar 2 22:33:05 PST 2014

Todd Fiala wrote:
> That sounds like you are once again seeing an x86_64 register infos section (using the x86_64 fpu register set) vs. the i386 set IIRC.
> Your host is a 32-bit x86 architecture, right?  (The one where you are running lldb?)
> If you do a svn status or git status, can you double check that you don't have any local changes?  I'll try on a 32-bit host with a clean repo to make sure I didn't have any cruft on my end 
> confusing the results.
Hi Todd,

My RegisterContextLinux_i386.cpp is up to date. I think the offset calcuation was broken by r202428:

$ svn diff --old=RegisterContextLinux_i386.cpp at r202427 --new=RegisterContextLinux_i386.cpp at r202428
Index: RegisterContextLinux_i386.cpp
--- RegisterContextLinux_i386.cpp    (revision 202427)
+++ RegisterContextLinux_i386.cpp    (revision 202428)
@@ -36,14 +36,30 @@

  struct FPR_i386
-    int32_t cwd;
-    int32_t swd;
-    int32_t twd;
-    int32_t fip;
-    int32_t fcs;
-    int32_t foo;
-    int32_t fos;
-    int32_t st_space [20];
+    uint16_t fctrl;         // FPU Control Word (fcw)
+    uint16_t fstat;         // FPU Status Word (fsw)
+    uint16_t ftag;          // FPU Tag Word (ftw)
+    uint16_t fop;           // Last Instruction Opcode (fop)
+    union
+    {
+        struct
+        {
+            uint64_t fip;   // Instruction Pointer
+            uint64_t fdp;   // Data Pointer
+        } x86_64;
+        struct
+        {
+            uint32_t fioff;   // FPU IP Offset (fip)
+            uint32_t fiseg;   // FPU IP Selector (fcs)
+            uint32_t fooff;   // FPU Operand Pointer Offset (foo)
+            uint32_t foseg;   // FPU Operand Pointer Selector (fos)
+        } i386;
+    } ptr;
+    uint32_t mxcsr;         // MXCSR Register State
+    uint32_t mxcsrmask;     // MXCSR Mask
+    MMSReg   stmm[8];       // 8*16 bytes for each FP-reg = 128 bytes
+    XMMReg   xmm[8];        // 8*16 bytes for each XMM-reg = 128 bytes
+    uint32_t padding[56];

  struct UserArea
@@ -69,6 +85,7 @@
  #define DR_SIZE sizeof(UserArea::u_debugreg[0])
  #define DR_OFFSET(reg_index) \
      (LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))
+#define FPR_SIZE(reg) sizeof(((FPR_i386*)NULL)->reg)

In my eyes it looks the representation of struct user_fpregs_struct within the struct UserArea has been replaced with that of struct user_fpxregs_struct. As the fpregs and fpxregs structs are of 
differing sizes pushes the offsets of the dr registers out.


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.

More information about the lldb-dev mailing list