[Lldb-commits] [PATCH] D130464: [lldb][ARM] Print mismatched registers in emulation tests

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 26 01:28:37 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3ebd54194446: [lldb][ARM] Print mismatched registers in emulation tests (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130464/new/

https://reviews.llvm.org/D130464

Files:
  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
  lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h


Index: lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h
===================================================================
--- lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h
+++ lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h
@@ -36,7 +36,8 @@
 
   bool LoadStateFromDictionary(lldb_private::OptionValueDictionary *test_data);
 
-  bool CompareState(EmulationStateARM &other_state);
+  bool CompareState(EmulationStateARM &other_state,
+                    lldb_private::Stream *out_stream);
 
   static size_t
   ReadPseudoMemory(lldb_private::EmulateInstruction *instruction, void *baton,
Index: lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
===================================================================
--- lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
+++ lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
@@ -251,22 +251,32 @@
                                                 reg_value.GetAsUInt64());
 }
 
-bool EmulationStateARM::CompareState(EmulationStateARM &other_state) {
+bool EmulationStateARM::CompareState(EmulationStateARM &other_state,
+                                     Stream *out_stream) {
   bool match = true;
 
   for (int i = 0; match && i < 17; ++i) {
-    if (m_gpr[i] != other_state.m_gpr[i])
+    if (m_gpr[i] != other_state.m_gpr[i]) {
       match = false;
+      out_stream->Printf("r%d: 0x%x != 0x%x\n", i, m_gpr[i],
+                         other_state.m_gpr[i]);
+    }
   }
 
   for (int i = 0; match && i < 32; ++i) {
-    if (m_vfp_regs.s_regs[i] != other_state.m_vfp_regs.s_regs[i])
+    if (m_vfp_regs.s_regs[i] != other_state.m_vfp_regs.s_regs[i]) {
       match = false;
+      out_stream->Printf("s%d: 0x%x != 0x%x\n", i, m_vfp_regs.s_regs[i],
+                         other_state.m_vfp_regs.s_regs[i]);
+    }
   }
 
   for (int i = 0; match && i < 16; ++i) {
-    if (m_vfp_regs.d_regs[i] != other_state.m_vfp_regs.d_regs[i])
+    if (m_vfp_regs.d_regs[i] != other_state.m_vfp_regs.d_regs[i]) {
       match = false;
+      out_stream->Printf("d%d: 0x%lx != 0x%lx\n", i + 16, m_vfp_regs.d_regs[i],
+                         other_state.m_vfp_regs.d_regs[i]);
+    }
   }
 
   return match;
Index: lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
===================================================================
--- lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -14453,10 +14453,10 @@
     return false;
   }
 
-  success = before_state.CompareState(after_state);
+  success = before_state.CompareState(after_state, out_stream);
   if (!success)
     out_stream->Printf(
-        "TestEmulation:  'before' and 'after' states do not match.\n");
+        "TestEmulation:  State after emulation does not match 'after' state.\n");
 
   return success;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130464.447614.patch
Type: text/x-patch
Size: 2864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220726/ecda003c/attachment-0001.bin>


More information about the lldb-commits mailing list