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> 


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181757 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 7ef4fac..dc30be6 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -295,12 +295,20 @@
         {
             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 @@
                             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 @@
     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