[lldb][ARM] Add tests for vpush/vpop D registers
authorDavid Spickett <david.spickett@linaro.org>
Fri, 22 Jul 2022 15:17:28 +0000 (15:17 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Tue, 26 Jul 2022 08:41:24 +0000 (08:41 +0000)
Previously we just checked via S regs and were not checking
memory content after pushes.

The vpush test confirms that the fix in https://reviews.llvm.org/D130307
is working.

Memory will only be checked if an "after" state is provided.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D130468

lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
lldb/test/API/arm/emulation/new-test-files/test-vpop-1-dregs-thumb.dat [new file with mode: 0644]
lldb/test/API/arm/emulation/new-test-files/test-vpush-1-dregs-thumb.dat [new file with mode: 0644]

index 6ac2f8a..f100647 100644 (file)
@@ -279,6 +279,18 @@ bool EmulationStateARM::CompareState(EmulationStateARM &other_state,
     }
   }
 
+  // other_state is the expected state. If it has memory, check it.
+  if (!other_state.m_memory.empty() && m_memory != other_state.m_memory) {
+    match = false;
+    out_stream->Printf("memory does not match\n");
+    out_stream->Printf("got memory:\n");
+    for (auto p : m_memory)
+      out_stream->Printf("0x%08lx: 0x%08x\n", p.first, p.second);
+    out_stream->Printf("expected memory:\n");
+    for (auto p : other_state.m_memory)
+      out_stream->Printf("0x%08lx: 0x%08x\n", p.first, p.second);
+  }
+
   return match;
 }
 
diff --git a/lldb/test/API/arm/emulation/new-test-files/test-vpop-1-dregs-thumb.dat b/lldb/test/API/arm/emulation/new-test-files/test-vpop-1-dregs-thumb.dat
new file mode 100644 (file)
index 0000000..a47b57e
--- /dev/null
@@ -0,0 +1,125 @@
+InstructionEmulationState={
+assembly_string="vpop    {d11, d12, d13, d14}"
+triple=thumb-apple-ios
+opcode=0xecbdbb08
+before_state={
+memory={
+address=0x2fdffe60
+data_encoding=uint32_t
+data=[
+0x22222222
+0x11111111
+0x44444444
+0x33333333
+0x66666666
+0x55555555
+0x88888888
+0x77777777
+]
+}
+registers={
+r0=0x00000000
+r1=0x00000001
+r2=0x00000002
+r3=0x00000003
+r4=0x00000004
+r5=0x00000005
+r6=0x00000006
+r7=0x2fdffe60
+r8=0x00000008
+r9=0x00000009
+r10=0x0000000a
+r11=0x0000000b
+r12=0x0000000c
+r13=0x2fdffe60
+r14=0x00002f80
+r15=0x00002ff8
+cpsr=0x60000030
+d0=0x0
+d1=0x0
+d2=0x0
+d3=0x0
+d4=0x0
+d5=0x0
+d6=0x0
+d7=0x0
+d8=0x0
+d9=0x0
+d10=0x0
+d11=0x0
+d12=0x0
+d13=0x0
+d14=0x0
+d15=0x0
+d16=0x0
+d17=0x0
+d18=0x0
+d19=0x0
+d20=0x0
+d21=0x0
+d22=0x0
+d23=0x0
+d24=0x0
+d25=0x0
+d26=0x0
+d27=0x0
+d28=0x0
+d29=0x0
+d30=0x0
+d31=0x0
+}
+}
+after_state={
+registers={
+r0=0x00000000
+r1=0x00000001
+r2=0x00000002
+r3=0x00000003
+r4=0x00000004
+r5=0x00000005
+r6=0x00000006
+r7=0x2fdffe60
+r8=0x00000008
+r9=0x00000009
+r10=0x0000000a
+r11=0x0000000b
+r12=0x0000000c
+r13=0x2fdffe80
+r14=0x00002f80
+r15=0x00002ffc
+cpsr=0x60000030
+d0=0x0000000000000000
+d1=0x0000000000000000
+d2=0x0000000000000000
+d3=0x0000000000000000
+d4=0x0000000000000000
+d5=0x0000000000000000
+d6=0x0000000000000000
+d7=0x0000000000000000
+d8=0x0000000000000000
+d9=0x0000000000000000
+d10=0x0000000000000000
+d11=0x1111111122222222
+d12=0x3333333344444444
+d13=0x5555555566666666
+d14=0x7777777788888888
+d15=0x0000000000000000
+d16=0x0000000000000000
+d17=0x0000000000000000
+d18=0x0000000000000000
+d19=0x0000000000000000
+d20=0x0000000000000000
+d21=0x0000000000000000
+d22=0x0000000000000000
+d23=0x0000000000000000
+d24=0x0000000000000000
+d25=0x0000000000000000
+d26=0x0000000000000000
+d27=0x0000000000000000
+d28=0x0000000000000000
+d29=0x0000000000000000
+d30=0x0000000000000000
+d31=0x0000000000000000
+}
+}
+}
diff --git a/lldb/test/API/arm/emulation/new-test-files/test-vpush-1-dregs-thumb.dat b/lldb/test/API/arm/emulation/new-test-files/test-vpush-1-dregs-thumb.dat
new file mode 100644 (file)
index 0000000..661db70
--- /dev/null
@@ -0,0 +1,125 @@
+InstructionEmulationState={
+assembly_string="vpush    {d11, d12, d13, d14}"
+triple=thumb-apple-ios
+opcode=0xed2dbb08
+before_state={
+registers={
+r0=0x00000000
+r1=0x00000001
+r2=0x00000002
+r3=0x00000003
+r4=0x00000004
+r5=0x00000005
+r6=0x00000006
+r7=0x2fdffe60
+r8=0x00000008
+r9=0x00000009
+r10=0x0000000a
+r11=0x0000000b
+r12=0x0000000c
+r13=0x2fdffe80
+r14=0x00002f80
+r15=0x00002ff8
+cpsr=0x60000030
+d0=0x0000000000000000
+d1=0x0000000000000000
+d2=0x0000000000000000
+d3=0x0000000000000000
+d4=0x0000000000000000
+d5=0x0000000000000000
+d6=0x0000000000000000
+d7=0x0000000000000000
+d8=0x0000000000000000
+d9=0x0000000000000000
+d10=0x0000000000000000
+d11=0x1111111122222222
+d12=0x3333333344444444
+d13=0x5555555566666666
+d14=0x7777777788888888
+d15=0x0000000000000000
+d16=0x0000000000000000
+d17=0x0000000000000000
+d18=0x0000000000000000
+d19=0x0000000000000000
+d20=0x0000000000000000
+d21=0x0000000000000000
+d22=0x0000000000000000
+d23=0x0000000000000000
+d24=0x0000000000000000
+d25=0x0000000000000000
+d26=0x0000000000000000
+d27=0x0000000000000000
+d28=0x0000000000000000
+d29=0x0000000000000000
+d30=0x0000000000000000
+d31=0x0000000000000000
+}
+}
+after_state={
+memory={
+address=0x2fdffe60
+data_encoding=uint32_t
+data=[
+0x22222222
+0x11111111
+0x44444444
+0x33333333
+0x66666666
+0x55555555
+0x88888888
+0x77777777
+]
+}
+registers={
+r0=0x00000000
+r1=0x00000001
+r2=0x00000002
+r3=0x00000003
+r4=0x00000004
+r5=0x00000005
+r6=0x00000006
+r7=0x2fdffe60
+r8=0x00000008
+r9=0x00000009
+r10=0x0000000a
+r11=0x0000000b
+r12=0x0000000c
+r13=0x2fdffe60
+r14=0x00002f80
+r15=0x00002ffc
+cpsr=0x60000030
+d0=0x0000000000000000
+d1=0x0000000000000000
+d2=0x0000000000000000
+d3=0x0000000000000000
+d4=0x0000000000000000
+d5=0x0000000000000000
+d6=0x0000000000000000
+d7=0x0000000000000000
+d8=0x0000000000000000
+d9=0x0000000000000000
+d10=0x0000000000000000
+d11=0x1111111122222222
+d12=0x3333333344444444
+d13=0x5555555566666666
+d14=0x7777777788888888
+d15=0x0000000000000000
+d16=0x0000000000000000
+d17=0x0000000000000000
+d18=0x0000000000000000
+d19=0x0000000000000000
+d20=0x0000000000000000
+d21=0x0000000000000000
+d22=0x0000000000000000
+d23=0x0000000000000000
+d24=0x0000000000000000
+d25=0x0000000000000000
+d26=0x0000000000000000
+d27=0x0000000000000000
+d28=0x0000000000000000
+d29=0x0000000000000000
+d30=0x0000000000000000
+d31=0x0000000000000000
+}
+}
+}