[Lldb-commits] [lldb] r181757 - A few more small tweaks to arm core file handling.

Jason Molenda jmolenda at apple.com
Mon May 13 21:50:48 PDT 2013


Author: jmolenda
Date: Mon May 13 23:50:47 2013
New Revision: 181757

URL: http://llvm.org/viewvc/llvm-project?rev=181757&view=rev
Log:
A few more small tweaks to arm core file handling.
Most importantly, have DoReadGPR/DoReadFPU/DoReadEXC return -1
to indicate failure if they're called.  Else these could override
the Error setting for the relevant thread state -- if the core file
didn't include a floating point thread state, for instance, these
functions would clear the Error setting for that register set and 
lldb would display random bytes as those registers' contents.
<rdar://problem/13665075> 

Modified:
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=181757&r1=181756&r2=181757&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Mon May 13 23:50:47 2013
@@ -295,12 +295,20 @@ public:
         {
             int flavor = data.GetU32 (&offset);
             uint32_t count = data.GetU32 (&offset);
+            lldb::offset_t next_thread_state = offset + (count * 4);
             switch (flavor)
             {
                 case GPRRegSet:
                     for (uint32_t i=0; i<count; ++i)
+                    {
                         gpr.r[i] = data.GetU32(&offset);
+                    }
+
+                    // Note that gpr.cpsr is also copied by the above loop; this loop technically extends 
+                    // one element past the end of the gpr.r[] array.
+
                     SetError (GPRRegSet, Read, 0);
+                    offset = next_thread_state;
                     break;
 
                 case FPURegSet:
@@ -318,14 +326,19 @@ public:
                             done = true;
                         }
                     }
+                    offset = next_thread_state;
                     break;
 
                 case EXCRegSet:
-                    exc.exception = data.GetU32(&offset);
-                    exc.fsr = data.GetU32(&offset);
-                    exc.far = data.GetU32(&offset);
-                    SetError (EXCRegSet, Read, 0);
+                    if (count == 3)
+                    {
+                        exc.exception = data.GetU32(&offset);
+                        exc.fsr = data.GetU32(&offset);
+                        exc.far = data.GetU32(&offset);
+                        SetError (EXCRegSet, Read, 0);
+                    }
                     done = true;
+                    offset = next_thread_state;
                     break;
 
                 // Unknown register set flavor, stop trying to parse.
@@ -338,19 +351,19 @@ protected:
     virtual int
     DoReadGPR (lldb::tid_t tid, int flavor, GPR &gpr)
     {
-        return 0;
+        return -1;
     }
 
     virtual int
     DoReadFPU (lldb::tid_t tid, int flavor, FPU &fpu)
     {
-        return 0;
+        return -1;
     }
 
     virtual int
     DoReadEXC (lldb::tid_t tid, int flavor, EXC &exc)
     {
-        return 0;
+        return -1;
     }
 
     virtual int





More information about the lldb-commits mailing list