[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 17/21] tests/tcg/aarch64: add a gdbstub testcase for SVE regis
From: |
Alex Bennée |
Subject: |
[PATCH v4 17/21] tests/tcg/aarch64: add a gdbstub testcase for SVE registers |
Date: |
Fri, 20 Dec 2019 12:04:34 +0000 |
We don't plumb this in yet as there are complications involved with
binutils and cross-architectiure debugging but it is one step closer.
Example:
./tests/guest-debug/run-test.py \
--qemu ./aarch64-linux-user/qemu-aarch64 \
--qargs "-cpu max" \
--bin ./tests/tcg/aarch64-linux-user/hello \
--test ~/lsrc/qemu.git/tests/tcg/aarch64/gdbstub/test-sve.py \
--gdb /home/alex/src/tools/binutils-gdb.git/install/bin/gdb
Signed-off-by: Alex Bennée <address@hidden>
---
tests/.gitignore | 1 +
tests/tcg/aarch64/gdbstub/test-sve.py | 75 +++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
create mode 100644 tests/tcg/aarch64/gdbstub/test-sve.py
diff --git a/tests/.gitignore b/tests/.gitignore
index f9c01708812..8cc428b58bb 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -10,6 +10,7 @@ qht-bench
rcutorture
test-*
!test-*.c
+!test-*.py
!docker/test-*
test-qapi-commands.[ch]
include/test-qapi-commands-sub-module.[ch]
diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py
b/tests/tcg/aarch64/gdbstub/test-sve.py
new file mode 100644
index 00000000000..11bc96fc06d
--- /dev/null
+++ b/tests/tcg/aarch64/gdbstub/test-sve.py
@@ -0,0 +1,75 @@
+from __future__ import print_function
+#
+# Test the SVE registers are visable and changeable via gdbstub
+#
+# This is launched via tests/guest-debug/run-test.py
+#
+
+import gdb
+
+MAGIC = 0xDEADBEEF
+
+failcount = 0
+
+def report(cond, msg):
+ "Report success/fail of test"
+ if cond:
+ print ("PASS: %s" % (msg))
+ else:
+ print ("FAIL: %s" % (msg))
+ global failcount
+ failcount += 1
+
+def run_test():
+ "Run through the tests one by one"
+
+ gdb.execute("info registers")
+ report(True, "info registers")
+
+ gdb.execute("info registers vector")
+ report(True, "info registers vector")
+
+ # Now all the zregs
+ frame = gdb.selected_frame()
+ for i in range(0, 32):
+ rname = "z%d" % (i)
+ zreg = frame.read_register(rname)
+ report(True, "Reading %s" % rname)
+ for j in range(0, 4):
+ cmd = "set $%s.q.u[%d] = 0x%x" % (rname, j, MAGIC)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for j in range(0, 4):
+ reg = "$%s.q.u[%d]" % (rname, j)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint128_t", "size of %s" % (reg))
+ for j in range(0, 8):
+ cmd = "set $%s.d.u[%d] = 0x%x" % (rname, j, MAGIC)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for j in range(0, 8):
+ reg = "$%s.d.u[%d]" % (rname, j)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint64_t", "size of %s" % (reg))
+ report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
+
+#
+# This runs as the script it sourced (via -x, via run-test.py)
+#
+
+try:
+ # These are not very useful in scripts
+ gdb.execute("set pagination off")
+ gdb.execute("set confirm off")
+
+ # Run the actual tests
+ run_test()
+except:
+ print ("GDB Exception: %s" % (sys.exc_info()[0]))
+ failcount += 1
+
+print("All tests complete: %d failures" % failcount)
+
+# Finally kill the inferior and exit gdb with a count of failures
+gdb.execute("kill")
+exit(failcount)
--
2.20.1
- [PATCH v4 00/21] gdbstub refactor and SVE support (+check-tcg tweaks), Alex Bennée, 2019/12/20
- [PATCH v4 01/21] gdbstub: make GDBState static and have common init function, Alex Bennée, 2019/12/20
- [PATCH v4 05/21] gdbstub: add helper for 128 bit registers, Alex Bennée, 2019/12/20
- [PATCH v4 03/21] gdbstub: move str_buf to GDBState and use GString, Alex Bennée, 2019/12/20
- [PATCH v4 04/21] gdbstub: move mem_buf to GDBState and use GByteArray, Alex Bennée, 2019/12/20
- [PATCH v4 06/21] target/arm: use gdb_get_reg helpers, Alex Bennée, 2019/12/20
- [PATCH v4 02/21] gdbstub: stop passing GDBState * around and use global, Alex Bennée, 2019/12/20
- [PATCH v4 07/21] target/m68k: use gdb_get_reg helpers, Alex Bennée, 2019/12/20
- [PATCH v4 10/21] target/arm: explicitly encode regnum in our XML, Alex Bennée, 2019/12/20
- [PATCH v4 09/21] target/arm: prepare for multiple dynamic XMLs, Alex Bennée, 2019/12/20
- [PATCH v4 17/21] tests/tcg/aarch64: add a gdbstub testcase for SVE registers,
Alex Bennée <=
- [PATCH v4 16/21] tests/guest-debug: add a simple test runner, Alex Bennée, 2019/12/20
- [PATCH v4 08/21] gdbstub: extend GByteArray to read register helpers, Alex Bennée, 2019/12/20
- [PATCH v4 18/21] tests/tcg/aarch64: add SVE iotcl test, Alex Bennée, 2019/12/20
- [PATCH v4 11/21] target/arm: default SVE length to 64 bytes for linux-user, Alex Bennée, 2019/12/20
- [PATCH v4 12/21] target/arm: generate xml description of our SVE registers, Alex Bennée, 2019/12/20
- [PATCH v4 15/21] tests/tcg/aarch64: userspace system register test, Alex Bennée, 2019/12/20
- [PATCH v4 14/21] target/arm: don't bother with id_aa64pfr0_read for USER_ONLY, Alex Bennée, 2019/12/20
- [PATCH v4 13/21] tests/tcg: add a configure compiler check for ARMv8.1 and SVE, Alex Bennée, 2019/12/20
- [PATCH v4 19/21] tests/tcg/aarch64: add test-sve-ioctl guest-debug test, Alex Bennée, 2019/12/20