* [PULL 01/23] default-configs: Add TARGET_XML_FILES definition
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 02/23] gdb-xml: fix duplicate register in arm-neon.xml Alex Bennée
` (22 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Philippe Mathieu-Daudé, Richard Henderson,
Alex Bennée, Laurent Vivier
From: Akihiko Odaki <akihiko.odaki@daynix.com>
loongarch64-linux-user has references to XML files so include them.
Fixes: d32688ecdb ("default-configs: Add loongarch linux-user support")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20231030054834.39145-6-akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[AJB: remove base32 from list]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-2-alex.bennee@linaro.org>
diff --git a/configs/targets/loongarch64-linux-user.mak b/configs/targets/loongarch64-linux-user.mak
index 7d1b964020..d878e5a113 100644
--- a/configs/targets/loongarch64-linux-user.mak
+++ b/configs/targets/loongarch64-linux-user.mak
@@ -1,3 +1,4 @@
# Default configuration for loongarch64-linux-user
TARGET_ARCH=loongarch64
TARGET_BASE_ARCH=loongarch
+TARGET_XML_FILES=gdb-xml/loongarch-base64.xml gdb-xml/loongarch-fpu.xml
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 02/23] gdb-xml: fix duplicate register in arm-neon.xml
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
2023-11-07 14:23 ` [PULL 01/23] default-configs: Add TARGET_XML_FILES definition Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 03/23] target/arm: mark the 32bit alias of PAR when LPAE enabled Alex Bennée
` (21 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Richard Henderson, Philippe Mathieu-Daudé
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Fixes: 56aebc8916 ("Add GDB XML register description support")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-3-alex.bennee@linaro.org>
diff --git a/gdb-xml/arm-neon.xml b/gdb-xml/arm-neon.xml
index 9dce0a996f..d61f6b8549 100644
--- a/gdb-xml/arm-neon.xml
+++ b/gdb-xml/arm-neon.xml
@@ -76,7 +76,7 @@
<reg name="q8" bitsize="128" type="neon_q"/>
<reg name="q9" bitsize="128" type="neon_q"/>
<reg name="q10" bitsize="128" type="neon_q"/>
- <reg name="q10" bitsize="128" type="neon_q"/>
+ <reg name="q11" bitsize="128" type="neon_q"/>
<reg name="q12" bitsize="128" type="neon_q"/>
<reg name="q13" bitsize="128" type="neon_q"/>
<reg name="q14" bitsize="128" type="neon_q"/>
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 03/23] target/arm: mark the 32bit alias of PAR when LPAE enabled
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
2023-11-07 14:23 ` [PULL 01/23] default-configs: Add TARGET_XML_FILES definition Alex Bennée
2023-11-07 14:23 ` [PULL 02/23] gdb-xml: fix duplicate register in arm-neon.xml Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 04/23] target/arm: hide all versions of DBGD[RS]AR from gdbstub Alex Bennée
` (20 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Richard Henderson, Peter Maydell,
open list:ARM TCG CPUs
We also mark it ARM_CP_NO_GDB so we avoid duplicate PAR's in the
system register XML we send to gdb.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20231107105145.2916124-1-alex.bennee@linaro.org>
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 5dc0d20a84..6acd87f5b9 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -3722,20 +3722,6 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
}
#endif
-static const ARMCPRegInfo vapa_cp_reginfo[] = {
- { .name = "PAR", .cp = 15, .crn = 7, .crm = 4, .opc1 = 0, .opc2 = 0,
- .access = PL1_RW, .resetvalue = 0,
- .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.par_s),
- offsetoflow32(CPUARMState, cp15.par_ns) },
- .writefn = par_write },
-#ifndef CONFIG_USER_ONLY
- /* This underdecoding is safe because the reginfo is NO_RAW. */
- { .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY,
- .access = PL1_W, .accessfn = ats_access,
- .writefn = ats_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
-#endif
-};
-
/* Return basic MPU access permission bits. */
static uint32_t simple_mpu_ap_bits(uint32_t val)
{
@@ -8904,6 +8890,27 @@ void register_cp_regs_for_features(ARMCPU *cpu)
define_arm_cp_regs(cpu, generic_timer_cp_reginfo);
}
if (arm_feature(env, ARM_FEATURE_VAPA)) {
+ ARMCPRegInfo vapa_cp_reginfo[] = {
+ { .name = "PAR", .cp = 15, .crn = 7, .crm = 4, .opc1 = 0, .opc2 = 0,
+ .access = PL1_RW, .resetvalue = 0,
+ .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.par_s),
+ offsetoflow32(CPUARMState, cp15.par_ns) },
+ .writefn = par_write},
+#ifndef CONFIG_USER_ONLY
+ /* This underdecoding is safe because the reginfo is NO_RAW. */
+ { .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY,
+ .access = PL1_W, .accessfn = ats_access,
+ .writefn = ats_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
+#endif
+ };
+
+ /*
+ * When LPAE exists this 32-bit PAR register is an alias of the
+ * 64-bit AArch32 PAR register defined in lpae_cp_reginfo[]
+ */
+ if (arm_feature(env, ARM_FEATURE_LPAE)) {
+ vapa_cp_reginfo[0].type = ARM_CP_ALIAS | ARM_CP_NO_GDB;
+ }
define_arm_cp_regs(cpu, vapa_cp_reginfo);
}
if (arm_feature(env, ARM_FEATURE_CACHE_TEST_CLEAN)) {
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 04/23] target/arm: hide all versions of DBGD[RS]AR from gdbstub
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (2 preceding siblings ...)
2023-11-07 14:23 ` [PULL 03/23] target/arm: mark the 32bit alias of PAR when LPAE enabled Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 05/23] target/arm: hide aliased MIDR " Alex Bennée
` (19 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Richard Henderson, Peter Maydell,
open list:ARM TCG CPUs
This avoids two duplicates being presented to gdbstub. As the
registers are RAZ anyway it is unlikely their value would be of use to
someone using gdbstub anyway.
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-5-alex.bennee@linaro.org>
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
index 79a3659c0c..cbfba532f5 100644
--- a/target/arm/debug_helper.c
+++ b/target/arm/debug_helper.c
@@ -937,14 +937,14 @@ static const ARMCPRegInfo debug_cp_reginfo[] = {
*/
{ .name = "DBGDRAR", .cp = 14, .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 0,
.access = PL0_R, .accessfn = access_tdra,
- .type = ARM_CP_CONST, .resetvalue = 0 },
+ .type = ARM_CP_CONST | ARM_CP_NO_GDB, .resetvalue = 0 },
{ .name = "MDRAR_EL1", .state = ARM_CP_STATE_AA64,
.opc0 = 2, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 0,
.access = PL1_R, .accessfn = access_tdra,
.type = ARM_CP_CONST, .resetvalue = 0 },
{ .name = "DBGDSAR", .cp = 14, .crn = 2, .crm = 0, .opc1 = 0, .opc2 = 0,
.access = PL0_R, .accessfn = access_tdra,
- .type = ARM_CP_CONST, .resetvalue = 0 },
+ .type = ARM_CP_CONST | ARM_CP_NO_GDB, .resetvalue = 0 },
/* Monitor debug system control register; the 32-bit alias is DBGDSCRext. */
{ .name = "MDSCR_EL1", .state = ARM_CP_STATE_BOTH,
.cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2,
@@ -1065,9 +1065,11 @@ static const ARMCPRegInfo debug_cp_reginfo[] = {
static const ARMCPRegInfo debug_lpae_cp_reginfo[] = {
/* 64 bit access versions of the (dummy) debug registers */
{ .name = "DBGDRAR", .cp = 14, .crm = 1, .opc1 = 0,
- .access = PL0_R, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
+ .access = PL0_R, .type = ARM_CP_CONST | ARM_CP_64BIT | ARM_CP_NO_GDB,
+ .resetvalue = 0 },
{ .name = "DBGDSAR", .cp = 14, .crm = 2, .opc1 = 0,
- .access = PL0_R, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
+ .access = PL0_R, .type = ARM_CP_CONST | ARM_CP_64BIT | ARM_CP_NO_GDB,
+ .resetvalue = 0 },
};
static void dbgwvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 05/23] target/arm: hide aliased MIDR from gdbstub
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (3 preceding siblings ...)
2023-11-07 14:23 ` [PULL 04/23] target/arm: hide all versions of DBGD[RS]AR from gdbstub Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 06/23] tests/tcg: add an explicit gdbstub register tester Alex Bennée
` (18 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Peter Maydell, open list:ARM TCG CPUs
This is just a constant alias register with the same value as the
"other" MIDR so it serves no purpose being presented to gdbstub.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20231106185112.2755262-6-alex.bennee@linaro.org>
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 6acd87f5b9..ff1970981e 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -9000,7 +9000,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
.type = ARM_CP_CONST, .resetvalue = cpu->revidr },
};
ARMCPRegInfo id_v8_midr_alias_cp_reginfo = {
- .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST,
+ .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST | ARM_CP_NO_GDB,
.cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 4,
.access = PL1_R, .resetvalue = cpu->midr
};
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 06/23] tests/tcg: add an explicit gdbstub register tester
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (4 preceding siblings ...)
2023-11-07 14:23 ` [PULL 05/23] target/arm: hide aliased MIDR " Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-13 11:23 ` Nicholas Piggin
2023-11-07 14:23 ` [PULL 07/23] tests/avocado: update the tcg_plugins test Alex Bennée
` (17 subsequent siblings)
23 siblings, 1 reply; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Akihiko Odaki, Luis Machado, Ilya Leoshkevich,
qemu-s390x, Nicholas Piggin, Daniel Henrique Barboza, qemu-ppc,
Philippe Mathieu-Daudé, Cédric Le Goater,
Richard Henderson, David Hildenbrand
We already do a couple of "info registers" for specific tests but this
is a more comprehensive multiarch test. It also has some output
helpful for debugging the gdbstub by showing which XML features are
advertised and what the underlying register numbers are.
My initial motivation was to see if there are any duplicate register
names exposed via the gdbstub while I was reviewing the proposed
register interface for TCG plugins.
Mismatches between the xml and remote-desc are reported for debugging
but do not fail the test.
We also skip the tests for the following arches for now until we can
investigate and fix any issues:
- s390x (fails to read v0l->v15l, not seen in remote-registers)
- ppc64 (fails to read vs0h->vs31h, not seen in remote-registers)
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Luis Machado <luis.machado@linaro.org>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: qemu-s390x@nongnu.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-7-alex.bennee@linaro.org>
diff --git a/MAINTAINERS b/MAINTAINERS
index b86ea7f75a..26e7633346 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2927,7 +2927,7 @@ F: gdbstub/*
F: include/exec/gdbstub.h
F: include/gdbstub/*
F: gdb-xml/
-F: tests/tcg/multiarch/gdbstub/
+F: tests/tcg/multiarch/gdbstub/*
F: scripts/feature_to_c.py
F: scripts/probe-gdb-support.py
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index f3bfaf1a22..d31ba8d6ae 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -93,12 +93,21 @@ run-gdbstub-thread-breakpoint: testthread
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
hitting a breakpoint on non-main thread)
+
+run-gdbstub-registers: sha512
+ $(call run-test, $@, $(GDB_SCRIPT) \
+ --gdb $(GDB) \
+ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
+ --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
+ checking register enumeration)
+
else
run-gdbstub-%:
$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
endif
EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
- run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint
+ run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
+ run-gdbstub-registers
# ARM Compatible Semi Hosting Tests
#
diff --git a/tests/tcg/multiarch/gdbstub/registers.py b/tests/tcg/multiarch/gdbstub/registers.py
new file mode 100644
index 0000000000..ff6076b09e
--- /dev/null
+++ b/tests/tcg/multiarch/gdbstub/registers.py
@@ -0,0 +1,197 @@
+# Exercise the register functionality by exhaustively iterating
+# through all supported registers on the system.
+#
+# This is launched via tests/guest-debug/run-test.py but you can also
+# call it directly if using it for debugging/introspection:
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import gdb
+import sys
+import xml.etree.ElementTree as ET
+
+initial_vlen = 0
+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 fetch_xml_regmap():
+ """
+ Iterate through the XML descriptions and validate.
+
+ We check for any duplicate registers and report them. Return a
+ reg_map hash containing the names, regnums and initial values of
+ all registers.
+ """
+
+ # First check the XML descriptions we have sent. Most arches
+ # support XML but a few of the ancient ones don't in which case we
+ # need to gracefully fail.
+
+ try:
+ xml = gdb.execute("maint print xml-tdesc", False, True)
+ except (gdb.error):
+ print("SKIP: target does not support XML")
+ return None
+
+ total_regs = 0
+ reg_map = {}
+ frame = gdb.selected_frame()
+
+ tree = ET.fromstring(xml)
+ for f in tree.findall("feature"):
+ name = f.attrib["name"]
+ regs = f.findall("reg")
+
+ total = len(regs)
+ total_regs += total
+ base = int(regs[0].attrib["regnum"])
+ top = int(regs[-1].attrib["regnum"])
+
+ print(f"feature: {name} has {total} registers from {base} to {top}")
+
+ for r in regs:
+ name = r.attrib["name"]
+ regnum = int(r.attrib["regnum"])
+ try:
+ value = frame.read_register(name)
+ except ValueError:
+ report(False, f"failed to read reg: {name}")
+
+ entry = { "name": name, "initial": value, "regnum": regnum }
+
+ if name in reg_map:
+ report(False, f"duplicate register {entry} vs {reg_map[name]}")
+ continue
+
+ reg_map[name] = entry
+
+ # Validate we match
+ report(total_regs == len(reg_map.keys()),
+ f"counted all {total_regs} registers in XML")
+
+ return reg_map
+
+def crosscheck_remote_xml(reg_map):
+ """
+ Cross-check the list of remote-registers with the XML info.
+ """
+
+ remote = gdb.execute("maint print remote-registers", False, True)
+ r_regs = remote.split("\n")
+
+ total_regs = len(reg_map.keys())
+ total_r_regs = 0
+
+ for r in r_regs:
+ fields = r.split()
+ # Some of the registers reported here are "pseudo" registers that
+ # gdb invents based on actual registers so we need to filter them
+ # out.
+ if len(fields) == 8:
+ r_name = fields[0]
+ r_regnum = int(fields[6])
+
+ # check in the XML
+ try:
+ x_reg = reg_map[r_name]
+ except KeyError:
+ report(False, f"{r_name} not in XML description")
+ continue
+
+ x_reg["seen"] = True
+ x_regnum = x_reg["regnum"]
+ if r_regnum != x_regnum:
+ report(False, f"{r_name} {r_regnum} == {x_regnum} (xml)")
+ else:
+ total_r_regs += 1
+
+ # Just print a mismatch in totals as gdb will filter out 64 bit
+ # registers on a 32 bit machine. Also print what is missing to
+ # help with debug.
+ if total_regs != total_r_regs:
+ print(f"xml-tdesc has ({total_regs}) registers")
+ print(f"remote-registers has ({total_r_regs}) registers")
+
+ for x_key in reg_map.keys():
+ x_reg = reg_map[x_key]
+ if "seen" not in x_reg:
+ print(f"{x_reg} wasn't seen in remote-registers")
+
+def complete_and_diff(reg_map):
+ """
+ Let the program run to (almost) completion and then iterate
+ through all the registers we know about and report which ones have
+ changed.
+ """
+ # Let the program get to the end and we can check what changed
+ b = gdb.Breakpoint("_exit")
+ if b.pending: # workaround Microblaze weirdness
+ b.delete()
+ gdb.Breakpoint("_Exit")
+
+ gdb.execute("continue")
+
+ frame = gdb.selected_frame()
+ changed = 0
+
+ for e in reg_map.values():
+ name = e["name"]
+ old_val = e["initial"]
+
+ try:
+ new_val = frame.read_register(name)
+ except:
+ report(False, f"failed to read {name} at end of run")
+ continue
+
+ if new_val != old_val:
+ print(f"{name} changes from {old_val} to {new_val}")
+ changed += 1
+
+ # as long as something changed we can be confident its working
+ report(changed > 0, f"{changed} registers were changed")
+
+
+def run_test():
+ "Run through the tests"
+
+ reg_map = fetch_xml_regmap()
+
+ if reg_map is not None:
+ crosscheck_remote_xml(reg_map)
+ complete_and_diff(reg_map)
+
+
+#
+# This runs as the script it sourced (via -x, via run-test.py)
+#
+try:
+ inferior = gdb.selected_inferior()
+ arch = inferior.architecture()
+ print("ATTACHED: %s" % arch.name())
+except (gdb.error, AttributeError):
+ print("SKIPPING (not connected)", file=sys.stderr)
+ exit(0)
+
+if gdb.parse_and_eval('$pc') == 0:
+ print("SKIP: PC not set")
+ exit(0)
+
+try:
+ run_test()
+except (gdb.error):
+ print ("GDB Exception: %s" % (sys.exc_info()[0]))
+ failcount += 1
+ pass
+
+print("All tests complete: %d failures" % failcount)
+exit(failcount)
diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target
index dee4f58dea..32dc0f9830 100644
--- a/tests/tcg/multiarch/system/Makefile.softmmu-target
+++ b/tests/tcg/multiarch/system/Makefile.softmmu-target
@@ -48,9 +48,20 @@ run-gdbstub-untimely-packet: hello
$(call quiet-command, \
(! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err), \
"GREP", file untimely-packet.gdb.err)
+
+run-gdbstub-registers: memory
+ $(call run-test, $@, $(GDB_SCRIPT) \
+ --gdb $(GDB) \
+ --qemu $(QEMU) \
+ --output $<.registers.gdb.out \
+ --qargs \
+ "-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
+ --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
+ softmmu gdbstub support)
else
run-gdbstub-%:
$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
endif
-MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet
+MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
+ run-gdbstub-untimely-packet run-gdbstub-registers
diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 5721c159f2..1d08076756 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -38,4 +38,11 @@ PPC64_TESTS += signal_save_restore_xer
PPC64_TESTS += xxspltw
PPC64_TESTS += test-aes
+ifneq ($(GDB),)
+# Skip for now until vsx registers sorted out
+run-gdbstub-registers:
+ $(call skip-test, $<, "BROKEN reading VSX registers")
+endif
+
+
TESTS += $(PPC64_TESTS)
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 826f0a18e4..49af091c38 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -100,6 +100,10 @@ run-gdbstub-svc: hello-s390x-asm
--bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
single-stepping svc)
+# Skip for now until vx registers sorted out
+run-gdbstub-registers:
+ $(call skip-test, $<, "BROKEN reading VX registers")
+
EXTRA_RUNS += run-gdbstub-signals-s390x run-gdbstub-svc
endif
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PULL 06/23] tests/tcg: add an explicit gdbstub register tester
2023-11-07 14:23 ` [PULL 06/23] tests/tcg: add an explicit gdbstub register tester Alex Bennée
@ 2023-11-13 11:23 ` Nicholas Piggin
2023-11-15 20:56 ` Alex Bennée
0 siblings, 1 reply; 31+ messages in thread
From: Nicholas Piggin @ 2023-11-13 11:23 UTC (permalink / raw)
To: Alex Bennée, qemu-devel
Cc: Akihiko Odaki, Luis Machado, Ilya Leoshkevich, qemu-s390x,
Daniel Henrique Barboza, qemu-ppc, Philippe Mathieu-Daudé,
Cédric Le Goater, Richard Henderson, David Hildenbrand
On Wed Nov 8, 2023 at 12:23 AM AEST, Alex Bennée wrote:
> We already do a couple of "info registers" for specific tests but this
> is a more comprehensive multiarch test. It also has some output
> helpful for debugging the gdbstub by showing which XML features are
> advertised and what the underlying register numbers are.
>
> My initial motivation was to see if there are any duplicate register
> names exposed via the gdbstub while I was reviewing the proposed
> register interface for TCG plugins.
>
> Mismatches between the xml and remote-desc are reported for debugging
> but do not fail the test.
>
> We also skip the tests for the following arches for now until we can
> investigate and fix any issues:
>
> - s390x (fails to read v0l->v15l, not seen in remote-registers)
> - ppc64 (fails to read vs0h->vs31h, not seen in remote-registers)
binutils-gdb.git/gdb/rs6000-tdep.c has:
static const char *
rs6000_register_name (struct gdbarch *gdbarch, int regno)
{
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* The upper half "registers" have names in the XML description,
but we present only the low GPRs and the full 64-bit registers
to the user. */
if (tdep->ppc_ev0_upper_regnum >= 0
&& tdep->ppc_ev0_upper_regnum <= regno
&& regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
return "";
/* Hide the upper halves of the vs0~vs31 registers. */
if (tdep->ppc_vsr0_regnum >= 0
&& tdep->ppc_vsr0_upper_regnum <= regno
&& regno < tdep->ppc_vsr0_upper_regnum + ppc_num_gprs)
return "";
(s390 looks similar for V0-V15 lower).
I guess it is because the upper half is not a real register but an
extension of an existing FP register to make a vector register. I
just don't know how that should be resolved with QEMU.
Should we put an exception in the test case for these? Or is there
something we should be doing differently with the XML regs?
i386 gdb does similar:
static const char *
i386_register_name (struct gdbarch *gdbarch, int regnum)
{
/* Hide the upper YMM registers. */
if (i386_ymmh_regnum_p (gdbarch, regnum))
return "";
/* Hide the upper YMM16-31 registers. */
if (i386_ymmh_avx512_regnum_p (gdbarch, regnum))
return "";
/* Hide the upper ZMM registers. */
if (i386_zmmh_regnum_p (gdbarch, regnum))
return "";
return tdesc_register_name (gdbarch, regnum);
}
So, I'm not sure how they don't fail this test. Does QEMU just
not have YMM/ZMM in XML regmap?
Thanks,
Nick
>
> Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
> Cc: Luis Machado <luis.machado@linaro.org>
> Cc: Ilya Leoshkevich <iii@linux.ibm.com>
> Cc: qemu-s390x@nongnu.org
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20231106185112.2755262-7-alex.bennee@linaro.org>
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b86ea7f75a..26e7633346 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2927,7 +2927,7 @@ F: gdbstub/*
> F: include/exec/gdbstub.h
> F: include/gdbstub/*
> F: gdb-xml/
> -F: tests/tcg/multiarch/gdbstub/
> +F: tests/tcg/multiarch/gdbstub/*
> F: scripts/feature_to_c.py
> F: scripts/probe-gdb-support.py
>
> diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
> index f3bfaf1a22..d31ba8d6ae 100644
> --- a/tests/tcg/multiarch/Makefile.target
> +++ b/tests/tcg/multiarch/Makefile.target
> @@ -93,12 +93,21 @@ run-gdbstub-thread-breakpoint: testthread
> --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
> --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
> hitting a breakpoint on non-main thread)
> +
> +run-gdbstub-registers: sha512
> + $(call run-test, $@, $(GDB_SCRIPT) \
> + --gdb $(GDB) \
> + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
> + --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
> + checking register enumeration)
> +
> else
> run-gdbstub-%:
> $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
> endif
> EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
> - run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint
> + run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
> + run-gdbstub-registers
>
> # ARM Compatible Semi Hosting Tests
> #
> diff --git a/tests/tcg/multiarch/gdbstub/registers.py b/tests/tcg/multiarch/gdbstub/registers.py
> new file mode 100644
> index 0000000000..ff6076b09e
> --- /dev/null
> +++ b/tests/tcg/multiarch/gdbstub/registers.py
> @@ -0,0 +1,197 @@
> +# Exercise the register functionality by exhaustively iterating
> +# through all supported registers on the system.
> +#
> +# This is launched via tests/guest-debug/run-test.py but you can also
> +# call it directly if using it for debugging/introspection:
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import gdb
> +import sys
> +import xml.etree.ElementTree as ET
> +
> +initial_vlen = 0
> +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 fetch_xml_regmap():
> + """
> + Iterate through the XML descriptions and validate.
> +
> + We check for any duplicate registers and report them. Return a
> + reg_map hash containing the names, regnums and initial values of
> + all registers.
> + """
> +
> + # First check the XML descriptions we have sent. Most arches
> + # support XML but a few of the ancient ones don't in which case we
> + # need to gracefully fail.
> +
> + try:
> + xml = gdb.execute("maint print xml-tdesc", False, True)
> + except (gdb.error):
> + print("SKIP: target does not support XML")
> + return None
> +
> + total_regs = 0
> + reg_map = {}
> + frame = gdb.selected_frame()
> +
> + tree = ET.fromstring(xml)
> + for f in tree.findall("feature"):
> + name = f.attrib["name"]
> + regs = f.findall("reg")
> +
> + total = len(regs)
> + total_regs += total
> + base = int(regs[0].attrib["regnum"])
> + top = int(regs[-1].attrib["regnum"])
> +
> + print(f"feature: {name} has {total} registers from {base} to {top}")
> +
> + for r in regs:
> + name = r.attrib["name"]
> + regnum = int(r.attrib["regnum"])
> + try:
> + value = frame.read_register(name)
> + except ValueError:
> + report(False, f"failed to read reg: {name}")
> +
> + entry = { "name": name, "initial": value, "regnum": regnum }
> +
> + if name in reg_map:
> + report(False, f"duplicate register {entry} vs {reg_map[name]}")
> + continue
> +
> + reg_map[name] = entry
> +
> + # Validate we match
> + report(total_regs == len(reg_map.keys()),
> + f"counted all {total_regs} registers in XML")
> +
> + return reg_map
> +
> +def crosscheck_remote_xml(reg_map):
> + """
> + Cross-check the list of remote-registers with the XML info.
> + """
> +
> + remote = gdb.execute("maint print remote-registers", False, True)
> + r_regs = remote.split("\n")
> +
> + total_regs = len(reg_map.keys())
> + total_r_regs = 0
> +
> + for r in r_regs:
> + fields = r.split()
> + # Some of the registers reported here are "pseudo" registers that
> + # gdb invents based on actual registers so we need to filter them
> + # out.
> + if len(fields) == 8:
> + r_name = fields[0]
> + r_regnum = int(fields[6])
> +
> + # check in the XML
> + try:
> + x_reg = reg_map[r_name]
> + except KeyError:
> + report(False, f"{r_name} not in XML description")
> + continue
> +
> + x_reg["seen"] = True
> + x_regnum = x_reg["regnum"]
> + if r_regnum != x_regnum:
> + report(False, f"{r_name} {r_regnum} == {x_regnum} (xml)")
> + else:
> + total_r_regs += 1
> +
> + # Just print a mismatch in totals as gdb will filter out 64 bit
> + # registers on a 32 bit machine. Also print what is missing to
> + # help with debug.
> + if total_regs != total_r_regs:
> + print(f"xml-tdesc has ({total_regs}) registers")
> + print(f"remote-registers has ({total_r_regs}) registers")
> +
> + for x_key in reg_map.keys():
> + x_reg = reg_map[x_key]
> + if "seen" not in x_reg:
> + print(f"{x_reg} wasn't seen in remote-registers")
> +
> +def complete_and_diff(reg_map):
> + """
> + Let the program run to (almost) completion and then iterate
> + through all the registers we know about and report which ones have
> + changed.
> + """
> + # Let the program get to the end and we can check what changed
> + b = gdb.Breakpoint("_exit")
> + if b.pending: # workaround Microblaze weirdness
> + b.delete()
> + gdb.Breakpoint("_Exit")
> +
> + gdb.execute("continue")
> +
> + frame = gdb.selected_frame()
> + changed = 0
> +
> + for e in reg_map.values():
> + name = e["name"]
> + old_val = e["initial"]
> +
> + try:
> + new_val = frame.read_register(name)
> + except:
> + report(False, f"failed to read {name} at end of run")
> + continue
> +
> + if new_val != old_val:
> + print(f"{name} changes from {old_val} to {new_val}")
> + changed += 1
> +
> + # as long as something changed we can be confident its working
> + report(changed > 0, f"{changed} registers were changed")
> +
> +
> +def run_test():
> + "Run through the tests"
> +
> + reg_map = fetch_xml_regmap()
> +
> + if reg_map is not None:
> + crosscheck_remote_xml(reg_map)
> + complete_and_diff(reg_map)
> +
> +
> +#
> +# This runs as the script it sourced (via -x, via run-test.py)
> +#
> +try:
> + inferior = gdb.selected_inferior()
> + arch = inferior.architecture()
> + print("ATTACHED: %s" % arch.name())
> +except (gdb.error, AttributeError):
> + print("SKIPPING (not connected)", file=sys.stderr)
> + exit(0)
> +
> +if gdb.parse_and_eval('$pc') == 0:
> + print("SKIP: PC not set")
> + exit(0)
> +
> +try:
> + run_test()
> +except (gdb.error):
> + print ("GDB Exception: %s" % (sys.exc_info()[0]))
> + failcount += 1
> + pass
> +
> +print("All tests complete: %d failures" % failcount)
> +exit(failcount)
> diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target
> index dee4f58dea..32dc0f9830 100644
> --- a/tests/tcg/multiarch/system/Makefile.softmmu-target
> +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target
> @@ -48,9 +48,20 @@ run-gdbstub-untimely-packet: hello
> $(call quiet-command, \
> (! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err), \
> "GREP", file untimely-packet.gdb.err)
> +
> +run-gdbstub-registers: memory
> + $(call run-test, $@, $(GDB_SCRIPT) \
> + --gdb $(GDB) \
> + --qemu $(QEMU) \
> + --output $<.registers.gdb.out \
> + --qargs \
> + "-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
> + --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
> + softmmu gdbstub support)
> else
> run-gdbstub-%:
> $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
> endif
>
> -MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet
> +MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
> + run-gdbstub-untimely-packet run-gdbstub-registers
> diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
> index 5721c159f2..1d08076756 100644
> --- a/tests/tcg/ppc64/Makefile.target
> +++ b/tests/tcg/ppc64/Makefile.target
> @@ -38,4 +38,11 @@ PPC64_TESTS += signal_save_restore_xer
> PPC64_TESTS += xxspltw
> PPC64_TESTS += test-aes
>
> +ifneq ($(GDB),)
> +# Skip for now until vsx registers sorted out
> +run-gdbstub-registers:
> + $(call skip-test, $<, "BROKEN reading VSX registers")
> +endif
> +
> +
> TESTS += $(PPC64_TESTS)
> diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
> index 826f0a18e4..49af091c38 100644
> --- a/tests/tcg/s390x/Makefile.target
> +++ b/tests/tcg/s390x/Makefile.target
> @@ -100,6 +100,10 @@ run-gdbstub-svc: hello-s390x-asm
> --bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
> single-stepping svc)
>
> +# Skip for now until vx registers sorted out
> +run-gdbstub-registers:
> + $(call skip-test, $<, "BROKEN reading VX registers")
> +
> EXTRA_RUNS += run-gdbstub-signals-s390x run-gdbstub-svc
> endif
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PULL 06/23] tests/tcg: add an explicit gdbstub register tester
2023-11-13 11:23 ` Nicholas Piggin
@ 2023-11-15 20:56 ` Alex Bennée
2023-11-16 9:56 ` Luis Machado
0 siblings, 1 reply; 31+ messages in thread
From: Alex Bennée @ 2023-11-15 20:56 UTC (permalink / raw)
To: Nicholas Piggin
Cc: qemu-devel, Akihiko Odaki, Luis Machado, Ilya Leoshkevich,
qemu-s390x, Daniel Henrique Barboza, qemu-ppc,
Philippe Mathieu-Daudé, Cédric Le Goater,
Richard Henderson, David Hildenbrand, gdb@gnu.org
"Nicholas Piggin" <npiggin@gmail.com> writes:
> On Wed Nov 8, 2023 at 12:23 AM AEST, Alex Bennée wrote:
>> We already do a couple of "info registers" for specific tests but this
>> is a more comprehensive multiarch test. It also has some output
>> helpful for debugging the gdbstub by showing which XML features are
>> advertised and what the underlying register numbers are.
>>
>> My initial motivation was to see if there are any duplicate register
>> names exposed via the gdbstub while I was reviewing the proposed
>> register interface for TCG plugins.
>>
>> Mismatches between the xml and remote-desc are reported for debugging
>> but do not fail the test.
>>
>> We also skip the tests for the following arches for now until we can
>> investigate and fix any issues:
>>
>> - s390x (fails to read v0l->v15l, not seen in remote-registers)
>> - ppc64 (fails to read vs0h->vs31h, not seen in remote-registers)
>
> binutils-gdb.git/gdb/rs6000-tdep.c has:
>
> static const char *
> rs6000_register_name (struct gdbarch *gdbarch, int regno)
> {
> ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
>
> /* The upper half "registers" have names in the XML description,
> but we present only the low GPRs and the full 64-bit registers
> to the user. */
> if (tdep->ppc_ev0_upper_regnum >= 0
> && tdep->ppc_ev0_upper_regnum <= regno
> && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
> return "";
>
> /* Hide the upper halves of the vs0~vs31 registers. */
> if (tdep->ppc_vsr0_regnum >= 0
> && tdep->ppc_vsr0_upper_regnum <= regno
> && regno < tdep->ppc_vsr0_upper_regnum + ppc_num_gprs)
> return "";
>
> (s390 looks similar for V0-V15 lower).
>
> I guess it is because the upper half is not a real register but an
> extension of an existing FP register to make a vector register. I
> just don't know how that should be resolved with QEMU.
>
> Should we put an exception in the test case for these? Or is there
> something we should be doing differently with the XML regs?
Yeah I suspect this is just inconsistency between targets on gdb. My
naive assumption was XML should match the displayed registers but it
seems there is additional filtering going on.
It seems in this case the registers are still there and have regnums (so
I assume the stub could be asked for them) but the names have been
squashed. I guess we could detect that and accept it?
>
> i386 gdb does similar:
>
> static const char *
> i386_register_name (struct gdbarch *gdbarch, int regnum)
> {
> /* Hide the upper YMM registers. */
> if (i386_ymmh_regnum_p (gdbarch, regnum))
> return "";
>
> /* Hide the upper YMM16-31 registers. */
> if (i386_ymmh_avx512_regnum_p (gdbarch, regnum))
> return "";
>
> /* Hide the upper ZMM registers. */
> if (i386_zmmh_regnum_p (gdbarch, regnum))
> return "";
>
> return tdesc_register_name (gdbarch, regnum);
> }
>
> So, I'm not sure how they don't fail this test. Does QEMU just
> not have YMM/ZMM in XML regmap?
No I think we only send the core one with XMM regs and there are no
additional registers sent via gdb_register_coprocessor.
>
> Thanks,
> Nick
>
>
>>
>> Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
>> Cc: Luis Machado <luis.machado@linaro.org>
>> Cc: Ilya Leoshkevich <iii@linux.ibm.com>
>> Cc: qemu-s390x@nongnu.org
>> Cc: Nicholas Piggin <npiggin@gmail.com>
>> Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
>> Cc: qemu-ppc@nongnu.org
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20231106185112.2755262-7-alex.bennee@linaro.org>
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index b86ea7f75a..26e7633346 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -2927,7 +2927,7 @@ F: gdbstub/*
>> F: include/exec/gdbstub.h
>> F: include/gdbstub/*
>> F: gdb-xml/
>> -F: tests/tcg/multiarch/gdbstub/
>> +F: tests/tcg/multiarch/gdbstub/*
>> F: scripts/feature_to_c.py
>> F: scripts/probe-gdb-support.py
>>
>> diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
>> index f3bfaf1a22..d31ba8d6ae 100644
>> --- a/tests/tcg/multiarch/Makefile.target
>> +++ b/tests/tcg/multiarch/Makefile.target
>> @@ -93,12 +93,21 @@ run-gdbstub-thread-breakpoint: testthread
>> --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
>> --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
>> hitting a breakpoint on non-main thread)
>> +
>> +run-gdbstub-registers: sha512
>> + $(call run-test, $@, $(GDB_SCRIPT) \
>> + --gdb $(GDB) \
>> + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
>> + --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
>> + checking register enumeration)
>> +
>> else
>> run-gdbstub-%:
>> $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
>> endif
>> EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
>> - run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint
>> + run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \
>> + run-gdbstub-registers
>>
>> # ARM Compatible Semi Hosting Tests
>> #
>> diff --git a/tests/tcg/multiarch/gdbstub/registers.py b/tests/tcg/multiarch/gdbstub/registers.py
>> new file mode 100644
>> index 0000000000..ff6076b09e
>> --- /dev/null
>> +++ b/tests/tcg/multiarch/gdbstub/registers.py
>> @@ -0,0 +1,197 @@
>> +# Exercise the register functionality by exhaustively iterating
>> +# through all supported registers on the system.
>> +#
>> +# This is launched via tests/guest-debug/run-test.py but you can also
>> +# call it directly if using it for debugging/introspection:
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +import gdb
>> +import sys
>> +import xml.etree.ElementTree as ET
>> +
>> +initial_vlen = 0
>> +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 fetch_xml_regmap():
>> + """
>> + Iterate through the XML descriptions and validate.
>> +
>> + We check for any duplicate registers and report them. Return a
>> + reg_map hash containing the names, regnums and initial values of
>> + all registers.
>> + """
>> +
>> + # First check the XML descriptions we have sent. Most arches
>> + # support XML but a few of the ancient ones don't in which case we
>> + # need to gracefully fail.
>> +
>> + try:
>> + xml = gdb.execute("maint print xml-tdesc", False, True)
>> + except (gdb.error):
>> + print("SKIP: target does not support XML")
>> + return None
>> +
>> + total_regs = 0
>> + reg_map = {}
>> + frame = gdb.selected_frame()
>> +
>> + tree = ET.fromstring(xml)
>> + for f in tree.findall("feature"):
>> + name = f.attrib["name"]
>> + regs = f.findall("reg")
>> +
>> + total = len(regs)
>> + total_regs += total
>> + base = int(regs[0].attrib["regnum"])
>> + top = int(regs[-1].attrib["regnum"])
>> +
>> + print(f"feature: {name} has {total} registers from {base} to {top}")
>> +
>> + for r in regs:
>> + name = r.attrib["name"]
>> + regnum = int(r.attrib["regnum"])
>> + try:
>> + value = frame.read_register(name)
>> + except ValueError:
>> + report(False, f"failed to read reg: {name}")
>> +
>> + entry = { "name": name, "initial": value, "regnum": regnum }
>> +
>> + if name in reg_map:
>> + report(False, f"duplicate register {entry} vs {reg_map[name]}")
>> + continue
>> +
>> + reg_map[name] = entry
>> +
>> + # Validate we match
>> + report(total_regs == len(reg_map.keys()),
>> + f"counted all {total_regs} registers in XML")
>> +
>> + return reg_map
>> +
>> +def crosscheck_remote_xml(reg_map):
>> + """
>> + Cross-check the list of remote-registers with the XML info.
>> + """
>> +
>> + remote = gdb.execute("maint print remote-registers", False, True)
>> + r_regs = remote.split("\n")
>> +
>> + total_regs = len(reg_map.keys())
>> + total_r_regs = 0
>> +
>> + for r in r_regs:
>> + fields = r.split()
>> + # Some of the registers reported here are "pseudo" registers that
>> + # gdb invents based on actual registers so we need to filter them
>> + # out.
>> + if len(fields) == 8:
>> + r_name = fields[0]
>> + r_regnum = int(fields[6])
>> +
>> + # check in the XML
>> + try:
>> + x_reg = reg_map[r_name]
>> + except KeyError:
>> + report(False, f"{r_name} not in XML description")
>> + continue
>> +
>> + x_reg["seen"] = True
>> + x_regnum = x_reg["regnum"]
>> + if r_regnum != x_regnum:
>> + report(False, f"{r_name} {r_regnum} == {x_regnum} (xml)")
>> + else:
>> + total_r_regs += 1
>> +
>> + # Just print a mismatch in totals as gdb will filter out 64 bit
>> + # registers on a 32 bit machine. Also print what is missing to
>> + # help with debug.
>> + if total_regs != total_r_regs:
>> + print(f"xml-tdesc has ({total_regs}) registers")
>> + print(f"remote-registers has ({total_r_regs}) registers")
>> +
>> + for x_key in reg_map.keys():
>> + x_reg = reg_map[x_key]
>> + if "seen" not in x_reg:
>> + print(f"{x_reg} wasn't seen in remote-registers")
>> +
>> +def complete_and_diff(reg_map):
>> + """
>> + Let the program run to (almost) completion and then iterate
>> + through all the registers we know about and report which ones have
>> + changed.
>> + """
>> + # Let the program get to the end and we can check what changed
>> + b = gdb.Breakpoint("_exit")
>> + if b.pending: # workaround Microblaze weirdness
>> + b.delete()
>> + gdb.Breakpoint("_Exit")
>> +
>> + gdb.execute("continue")
>> +
>> + frame = gdb.selected_frame()
>> + changed = 0
>> +
>> + for e in reg_map.values():
>> + name = e["name"]
>> + old_val = e["initial"]
>> +
>> + try:
>> + new_val = frame.read_register(name)
>> + except:
>> + report(False, f"failed to read {name} at end of run")
>> + continue
>> +
>> + if new_val != old_val:
>> + print(f"{name} changes from {old_val} to {new_val}")
>> + changed += 1
>> +
>> + # as long as something changed we can be confident its working
>> + report(changed > 0, f"{changed} registers were changed")
>> +
>> +
>> +def run_test():
>> + "Run through the tests"
>> +
>> + reg_map = fetch_xml_regmap()
>> +
>> + if reg_map is not None:
>> + crosscheck_remote_xml(reg_map)
>> + complete_and_diff(reg_map)
>> +
>> +
>> +#
>> +# This runs as the script it sourced (via -x, via run-test.py)
>> +#
>> +try:
>> + inferior = gdb.selected_inferior()
>> + arch = inferior.architecture()
>> + print("ATTACHED: %s" % arch.name())
>> +except (gdb.error, AttributeError):
>> + print("SKIPPING (not connected)", file=sys.stderr)
>> + exit(0)
>> +
>> +if gdb.parse_and_eval('$pc') == 0:
>> + print("SKIP: PC not set")
>> + exit(0)
>> +
>> +try:
>> + run_test()
>> +except (gdb.error):
>> + print ("GDB Exception: %s" % (sys.exc_info()[0]))
>> + failcount += 1
>> + pass
>> +
>> +print("All tests complete: %d failures" % failcount)
>> +exit(failcount)
>> diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target
>> index dee4f58dea..32dc0f9830 100644
>> --- a/tests/tcg/multiarch/system/Makefile.softmmu-target
>> +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target
>> @@ -48,9 +48,20 @@ run-gdbstub-untimely-packet: hello
>> $(call quiet-command, \
>> (! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err), \
>> "GREP", file untimely-packet.gdb.err)
>> +
>> +run-gdbstub-registers: memory
>> + $(call run-test, $@, $(GDB_SCRIPT) \
>> + --gdb $(GDB) \
>> + --qemu $(QEMU) \
>> + --output $<.registers.gdb.out \
>> + --qargs \
>> + "-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
>> + --bin $< --test $(MULTIARCH_SRC)/gdbstub/registers.py, \
>> + softmmu gdbstub support)
>> else
>> run-gdbstub-%:
>> $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
>> endif
>>
>> -MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet
>> +MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
>> + run-gdbstub-untimely-packet run-gdbstub-registers
>> diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
>> index 5721c159f2..1d08076756 100644
>> --- a/tests/tcg/ppc64/Makefile.target
>> +++ b/tests/tcg/ppc64/Makefile.target
>> @@ -38,4 +38,11 @@ PPC64_TESTS += signal_save_restore_xer
>> PPC64_TESTS += xxspltw
>> PPC64_TESTS += test-aes
>>
>> +ifneq ($(GDB),)
>> +# Skip for now until vsx registers sorted out
>> +run-gdbstub-registers:
>> + $(call skip-test, $<, "BROKEN reading VSX registers")
>> +endif
>> +
>> +
>> TESTS += $(PPC64_TESTS)
>> diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
>> index 826f0a18e4..49af091c38 100644
>> --- a/tests/tcg/s390x/Makefile.target
>> +++ b/tests/tcg/s390x/Makefile.target
>> @@ -100,6 +100,10 @@ run-gdbstub-svc: hello-s390x-asm
>> --bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
>> single-stepping svc)
>>
>> +# Skip for now until vx registers sorted out
>> +run-gdbstub-registers:
>> + $(call skip-test, $<, "BROKEN reading VX registers")
>> +
>> EXTRA_RUNS += run-gdbstub-signals-s390x run-gdbstub-svc
>> endif
>>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PULL 06/23] tests/tcg: add an explicit gdbstub register tester
2023-11-15 20:56 ` Alex Bennée
@ 2023-11-16 9:56 ` Luis Machado
2023-11-16 14:59 ` Alex Bennée
0 siblings, 1 reply; 31+ messages in thread
From: Luis Machado @ 2023-11-16 9:56 UTC (permalink / raw)
To: Alex Bennée, Nicholas Piggin
Cc: qemu-devel, Akihiko Odaki, Luis Machado, Ilya Leoshkevich,
qemu-s390x, Daniel Henrique Barboza, qemu-ppc,
Philippe Mathieu-Daudé, Cédric Le Goater,
Richard Henderson, David Hildenbrand, gdb@gnu.org
On 11/15/23 20:56, Alex Bennée via Gdb wrote:
> "Nicholas Piggin" <npiggin@gmail.com> writes:
>
>> On Wed Nov 8, 2023 at 12:23 AM AEST, Alex Bennée wrote:
>>> We already do a couple of "info registers" for specific tests but this
>>> is a more comprehensive multiarch test. It also has some output
>>> helpful for debugging the gdbstub by showing which XML features are
>>> advertised and what the underlying register numbers are.
>>>
>>> My initial motivation was to see if there are any duplicate register
>>> names exposed via the gdbstub while I was reviewing the proposed
>>> register interface for TCG plugins.
>>>
>>> Mismatches between the xml and remote-desc are reported for debugging
>>> but do not fail the test.
>>>
>>> We also skip the tests for the following arches for now until we can
>>> investigate and fix any issues:
>>>
>>> - s390x (fails to read v0l->v15l, not seen in remote-registers)
>>> - ppc64 (fails to read vs0h->vs31h, not seen in remote-registers)
>>
>> binutils-gdb.git/gdb/rs6000-tdep.c has:
>>
>> static const char *
>> rs6000_register_name (struct gdbarch *gdbarch, int regno)
>> {
>> ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
>>
>> /* The upper half "registers" have names in the XML description,
>> but we present only the low GPRs and the full 64-bit registers
>> to the user. */
>> if (tdep->ppc_ev0_upper_regnum >= 0
>> && tdep->ppc_ev0_upper_regnum <= regno
>> && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
>> return "";
>>
>> /* Hide the upper halves of the vs0~vs31 registers. */
>> if (tdep->ppc_vsr0_regnum >= 0
>> && tdep->ppc_vsr0_upper_regnum <= regno
>> && regno < tdep->ppc_vsr0_upper_regnum + ppc_num_gprs)
>> return "";
>>
>> (s390 looks similar for V0-V15 lower).
>>
>> I guess it is because the upper half is not a real register but an
>> extension of an existing FP register to make a vector register. I
>> just don't know how that should be resolved with QEMU.
>>
>> Should we put an exception in the test case for these? Or is there
>> something we should be doing differently with the XML regs?
>
> Yeah I suspect this is just inconsistency between targets on gdb. My
> naive assumption was XML should match the displayed registers but it
> seems there is additional filtering going on.
>
> It seems in this case the registers are still there and have regnums (so
> I assume the stub could be asked for them) but the names have been
> squashed. I guess we could detect that and accept it?
>
>>
>> i386 gdb does similar:
>>
>> static const char *
>> i386_register_name (struct gdbarch *gdbarch, int regnum)
>> {
>> /* Hide the upper YMM registers. */
>> if (i386_ymmh_regnum_p (gdbarch, regnum))
>> return "";
>>
>> /* Hide the upper YMM16-31 registers. */
>> if (i386_ymmh_avx512_regnum_p (gdbarch, regnum))
>> return "";
>>
>> /* Hide the upper ZMM registers. */
>> if (i386_zmmh_regnum_p (gdbarch, regnum))
>> return "";
>>
>> return tdesc_register_name (gdbarch, regnum);
>> }
>>
>> So, I'm not sure how they don't fail this test. Does QEMU just
>> not have YMM/ZMM in XML regmap?
>
> No I think we only send the core one with XMM regs and there are no
> additional registers sent via gdb_register_coprocessor.
>
>>
>> Thanks,
>> Nick
FTR, luis.machado@linaro.org doesn't exist anymore.
As for the XML, it serves as an architecture hint/description of what features and registers
are available.
GDB will process that and will potentially include additional pseudo-registers (so QEMU doesn't
need to do so, unless it is some pseudo-register not accounted by gdb).
The rest of the features/registers gdb doesn't care about, it will just add them to the end of the
list, and will assign whatever number is next. GDB will be able to read/write them, but nothing more
than that.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PULL 06/23] tests/tcg: add an explicit gdbstub register tester
2023-11-16 9:56 ` Luis Machado
@ 2023-11-16 14:59 ` Alex Bennée
0 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-16 14:59 UTC (permalink / raw)
To: Luis Machado
Cc: Nicholas Piggin, qemu-devel, Akihiko Odaki, Luis Machado,
Ilya Leoshkevich, qemu-s390x, Daniel Henrique Barboza, qemu-ppc,
Philippe Mathieu-Daudé, Cédric Le Goater,
Richard Henderson, David Hildenbrand, gdb@gnu.org
Luis Machado <luis.machado@arm.com> writes:
> On 11/15/23 20:56, Alex Bennée via Gdb wrote:
>> "Nicholas Piggin" <npiggin@gmail.com> writes:
>>
>>> On Wed Nov 8, 2023 at 12:23 AM AEST, Alex Bennée wrote:
>>>> We already do a couple of "info registers" for specific tests but this
>>>> is a more comprehensive multiarch test. It also has some output
>>>> helpful for debugging the gdbstub by showing which XML features are
>>>> advertised and what the underlying register numbers are.
>>>>
>>>> My initial motivation was to see if there are any duplicate register
>>>> names exposed via the gdbstub while I was reviewing the proposed
>>>> register interface for TCG plugins.
>>>>
>>>> Mismatches between the xml and remote-desc are reported for debugging
>>>> but do not fail the test.
>>>>
>>>> We also skip the tests for the following arches for now until we can
>>>> investigate and fix any issues:
>>>>
>>>> - s390x (fails to read v0l->v15l, not seen in remote-registers)
>>>> - ppc64 (fails to read vs0h->vs31h, not seen in remote-registers)
>>>
>>> binutils-gdb.git/gdb/rs6000-tdep.c has:
>>>
>>> static const char *
>>> rs6000_register_name (struct gdbarch *gdbarch, int regno)
>>> {
>>> ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
>>>
>>> /* The upper half "registers" have names in the XML description,
>>> but we present only the low GPRs and the full 64-bit registers
>>> to the user. */
>>> if (tdep->ppc_ev0_upper_regnum >= 0
>>> && tdep->ppc_ev0_upper_regnum <= regno
>>> && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
>>> return "";
>>>
>>> /* Hide the upper halves of the vs0~vs31 registers. */
>>> if (tdep->ppc_vsr0_regnum >= 0
>>> && tdep->ppc_vsr0_upper_regnum <= regno
>>> && regno < tdep->ppc_vsr0_upper_regnum + ppc_num_gprs)
>>> return "";
>>>
>>> (s390 looks similar for V0-V15 lower).
>>>
>>> I guess it is because the upper half is not a real register but an
>>> extension of an existing FP register to make a vector register. I
>>> just don't know how that should be resolved with QEMU.
>>>
>>> Should we put an exception in the test case for these? Or is there
>>> something we should be doing differently with the XML regs?
>>
>> Yeah I suspect this is just inconsistency between targets on gdb. My
>> naive assumption was XML should match the displayed registers but it
>> seems there is additional filtering going on.
>>
>> It seems in this case the registers are still there and have regnums (so
>> I assume the stub could be asked for them) but the names have been
>> squashed. I guess we could detect that and accept it?
>>
>>>
>>> i386 gdb does similar:
>>>
>>> static const char *
>>> i386_register_name (struct gdbarch *gdbarch, int regnum)
>>> {
>>> /* Hide the upper YMM registers. */
>>> if (i386_ymmh_regnum_p (gdbarch, regnum))
>>> return "";
>>>
>>> /* Hide the upper YMM16-31 registers. */
>>> if (i386_ymmh_avx512_regnum_p (gdbarch, regnum))
>>> return "";
>>>
>>> /* Hide the upper ZMM registers. */
>>> if (i386_zmmh_regnum_p (gdbarch, regnum))
>>> return "";
>>>
>>> return tdesc_register_name (gdbarch, regnum);
>>> }
>>>
>>> So, I'm not sure how they don't fail this test. Does QEMU just
>>> not have YMM/ZMM in XML regmap?
>>
>> No I think we only send the core one with XMM regs and there are no
>> additional registers sent via gdb_register_coprocessor.
>>
>>>
>>> Thanks,
>>> Nick
>
> FTR, luis.machado@linaro.org doesn't exist anymore.
>
> As for the XML, it serves as an architecture hint/description of what features and registers
> are available.
>
> GDB will process that and will potentially include additional pseudo-registers (so QEMU doesn't
> need to do so, unless it is some pseudo-register not accounted by gdb).
>
> The rest of the features/registers gdb doesn't care about, it will just add them to the end of the
> list, and will assign whatever number is next. GDB will be able to read/write them, but nothing more
> than that.
So with a bit of fiddling I can do:
modified tests/tcg/multiarch/gdbstub/registers.py
@@ -44,7 +44,6 @@ def fetch_xml_regmap():
total_regs = 0
reg_map = {}
- frame = gdb.selected_frame()
tree = ET.fromstring(xml)
for f in tree.findall("feature"):
@@ -61,12 +60,8 @@ def fetch_xml_regmap():
for r in regs:
name = r.attrib["name"]
regnum = int(r.attrib["regnum"])
- try:
- value = frame.read_register(name)
- except ValueError:
- report(False, f"failed to read reg: {name}")
- entry = { "name": name, "initial": value, "regnum": regnum }
+ entry = { "name": name, "regnum": regnum }
if name in reg_map:
report(False, f"duplicate register {entry} vs {reg_map[name]}")
@@ -80,6 +75,15 @@ def fetch_xml_regmap():
return reg_map
+def get_register_by_regnum(reg_map, regnum):
+ """
+ Helper to find a register from the map via its XML regnum
+ """
+ for regname, entry in reg_map.items():
+ if entry['regnum'] == regnum:
+ return entry
+ return None
+
def crosscheck_remote_xml(reg_map):
"""
Cross-check the list of remote-registers with the XML info.
@@ -90,6 +94,7 @@ def crosscheck_remote_xml(reg_map):
total_regs = len(reg_map.keys())
total_r_regs = 0
+ total_r_elided_regs = 0
for r in r_regs:
fields = r.split()
@@ -100,6 +105,15 @@ def crosscheck_remote_xml(reg_map):
r_name = fields[0]
r_regnum = int(fields[6])
+ # Some registers are "hidden" so don't have a name
+ # although they still should have a register number
+ if r_name == "''":
+ total_r_elided_regs += 1
+ x_reg = get_register_by_regnum(reg_map, r_regnum)
+ if x_reg is not None:
+ x_reg["hidden"] = True
+ continue
+
# check in the XML
try:
x_reg = reg_map[r_name]
@@ -118,13 +132,38 @@ def crosscheck_remote_xml(reg_map):
# registers on a 32 bit machine. Also print what is missing to
# help with debug.
if total_regs != total_r_regs:
- print(f"xml-tdesc has ({total_regs}) registers")
- print(f"remote-registers has ({total_r_regs}) registers")
+ print(f"xml-tdesc has {total_regs} registers")
+ print(f"remote-registers has {total_r_regs} registers")
+ print(f"of which {total_r_elided_regs} are hidden")
for x_key in reg_map.keys():
x_reg = reg_map[x_key]
- if "seen" not in x_reg:
- print(f"{x_reg} wasn't seen in remote-registers")
+ if "hidden" in x_reg:
+ print(f"{x_reg} elided by gdb")
+ elif "seen" not in x_reg:
+ report(False, f"{x_reg} wasn't seen in remote-registers")
+
+def initial_register_read(reg_map):
+ """
+ Do an initial read of all registers that we know gdb cares about
+ (so ignore the elided ones).
+ """
+ frame = gdb.selected_frame()
+
+ for e in reg_map.values():
+ name = e["name"]
+ regnum = e["regnum"]
+
+ try:
+ if "hidden" in e:
+ value = frame.read_register(regnum)
+ else:
+ value = frame.read_register(name)
+
+ e["initial"] = value
+ except ValueError:
+ report(False, f"failed to read reg: {name}")
+
def complete_and_diff(reg_map):
"""
@@ -144,18 +183,19 @@ def complete_and_diff(reg_map):
changed = 0
for e in reg_map.values():
- name = e["name"]
- old_val = e["initial"]
+ if "hidden" not in e:
+ name = e["name"]
+ old_val = e["initial"]
- try:
- new_val = frame.read_register(name)
- except:
- report(False, f"failed to read {name} at end of run")
- continue
+ try:
+ new_val = frame.read_register(name)
+ except ValueError:
+ report(False, f"failed to read {name} at end of run")
+ continue
- if new_val != old_val:
- print(f"{name} changes from {old_val} to {new_val}")
- changed += 1
+ if new_val != old_val:
+ print(f"{name} changes from {old_val} to {new_val}")
+ changed += 1
# as long as something changed we can be confident its working
report(changed > 0, f"{changed} registers were changed")
@@ -168,6 +208,7 @@ def run_test():
if reg_map is not None:
crosscheck_remote_xml(reg_map)
+ initial_register_read(reg_map)
complete_and_diff(reg_map)
I'll wrap that into my next set of patches.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PULL 07/23] tests/avocado: update the tcg_plugins test
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (5 preceding siblings ...)
2023-11-07 14:23 ` [PULL 06/23] tests/tcg: add an explicit gdbstub register tester Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 08/23] gdbstub: Add num_regs member to GDBFeature Alex Bennée
` (16 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Richard Henderson, Alexandre Iooss,
Mahmoud Mandour, Cleber Rosa, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal
There are a number of things that are broken on the test currently so
lets fix that up:
- replace retired Debian kernel for tuxrun_baseline one
- remove "detected repeat instructions test" since ea185a55
- log total counted instructions/memory accesses
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-8-alex.bennee@linaro.org>
diff --git a/tests/avocado/tcg_plugins.py b/tests/avocado/tcg_plugins.py
index 642d2e49e3..15fd87b2c1 100644
--- a/tests/avocado/tcg_plugins.py
+++ b/tests/avocado/tcg_plugins.py
@@ -54,13 +54,11 @@ def run_vm(self, kernel_path, kernel_command_line,
class PluginKernelNormal(PluginKernelBase):
def _grab_aarch64_kernel(self):
- kernel_url = ('http://security.debian.org/'
- 'debian-security/pool/updates/main/l/linux-signed-arm64/'
- 'linux-image-4.19.0-12-arm64_4.19.152-1_arm64.deb')
- kernel_sha1 = '2036c2792f80ac9c4ccaae742b2e0a28385b6010'
- kernel_deb = self.fetch_asset(kernel_url, asset_hash=kernel_sha1)
- kernel_path = self.extract_from_deb(kernel_deb,
- "/boot/vmlinuz-4.19.0-12-arm64")
+ kernel_url = ('https://storage.tuxboot.com/20230331/arm64/Image')
+ kernel_sha256 = 'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7'
+ kernel_path = self.fetch_asset(kernel_url,
+ asset_hash=kernel_sha256,
+ algorithm = "sha256")
return kernel_path
def test_aarch64_virt_insn(self):
@@ -88,6 +86,10 @@ def test_aarch64_virt_insn(self):
m = re.search(br"insns: (?P<count>\d+)", s)
if "count" not in m.groupdict():
self.fail("Failed to find instruction count")
+ else:
+ count = int(m.group("count"))
+ self.log.info(f"Counted: {count} instructions")
+
def test_aarch64_virt_insn_icount(self):
"""
@@ -111,9 +113,13 @@ def test_aarch64_virt_insn_icount(self):
with plugin_log as lf, \
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
- m = re.search(br"detected repeat execution @ (?P<addr>0x[0-9A-Fa-f]+)", s)
- if m is not None and "addr" in m.groupdict():
- self.fail("detected repeated instructions")
+
+ m = re.search(br"insns: (?P<count>\d+)", s)
+ if "count" not in m.groupdict():
+ self.fail("Failed to find instruction count")
+ else:
+ count = int(m.group("count"))
+ self.log.info(f"Counted: {count} instructions")
def test_aarch64_virt_mem_icount(self):
"""
@@ -145,3 +151,5 @@ def test_aarch64_virt_mem_icount(self):
callback = int(m[1])
if inline != callback:
self.fail("mismatched access counts")
+ else:
+ self.log.info(f"Counted {inline} memory accesses")
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 08/23] gdbstub: Add num_regs member to GDBFeature
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (6 preceding siblings ...)
2023-11-07 14:23 ` [PULL 07/23] tests/avocado: update the tcg_plugins test Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 09/23] gdbstub: Introduce gdb_find_static_feature() Alex Bennée
` (15 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Philippe Mathieu-Daudé, Alex Bennée,
John Snow, Cleber Rosa
From: Akihiko Odaki <akihiko.odaki@daynix.com>
Currently the number of registers exposed to GDB is written as magic
numbers in code. Derive the number of registers GDB actually see from
XML files to replace the magic numbers in code later.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231025093128.33116-2-akihiko.odaki@daynix.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-9-alex.bennee@linaro.org>
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 1a01c35f8e..a43aa34dad 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -13,6 +13,7 @@
typedef struct GDBFeature {
const char *xmlname;
const char *xml;
+ int num_regs;
} GDBFeature;
diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py
index bcbcb83beb..e04d6b2df7 100644
--- a/scripts/feature_to_c.py
+++ b/scripts/feature_to_c.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
-import os, sys
+import os, sys, xml.etree.ElementTree
def writeliteral(indent, bytes):
sys.stdout.write(' ' * indent)
@@ -39,10 +39,52 @@ def writeliteral(indent, bytes):
with open(input, 'rb') as file:
read = file.read()
+ parser = xml.etree.ElementTree.XMLPullParser(['start', 'end'])
+ parser.feed(read)
+ events = parser.read_events()
+ event, element = next(events)
+ if event != 'start':
+ sys.stderr.write(f'unexpected event: {event}\n')
+ exit(1)
+ if element.tag != 'feature':
+ sys.stderr.write(f'unexpected start tag: {element.tag}\n')
+ exit(1)
+
+ regnum = 0
+ regnums = []
+ tags = ['feature']
+ for event, element in events:
+ if event == 'end':
+ if element.tag != tags[len(tags) - 1]:
+ sys.stderr.write(f'unexpected end tag: {element.tag}\n')
+ exit(1)
+
+ tags.pop()
+ if element.tag == 'feature':
+ break
+ elif event == 'start':
+ if len(tags) < 2 and element.tag == 'reg':
+ if 'regnum' in element.attrib:
+ regnum = int(element.attrib['regnum'])
+
+ regnums.append(regnum)
+ regnum += 1
+
+ tags.append(element.tag)
+ else:
+ raise Exception(f'unexpected event: {event}\n')
+
+ if len(tags):
+ sys.stderr.write('unterminated feature tag\n')
+ exit(1)
+
+ base_reg = min(regnums)
+ num_regs = max(regnums) - base_reg + 1 if len(regnums) else 0
+
sys.stdout.write(' {\n')
writeliteral(8, bytes(os.path.basename(input), 'utf-8'))
sys.stdout.write(',\n')
writeliteral(8, read)
- sys.stdout.write('\n },\n')
+ sys.stdout.write(f',\n {num_regs},\n }},\n')
sys.stdout.write(' { NULL }\n};\n')
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 09/23] gdbstub: Introduce gdb_find_static_feature()
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (7 preceding siblings ...)
2023-11-07 14:23 ` [PULL 08/23] gdbstub: Add num_regs member to GDBFeature Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 10/23] gdbstub: Introduce GDBFeatureBuilder Alex Bennée
` (14 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Philippe Mathieu-Daudé, Alex Bennée,
Richard Henderson
From: Akihiko Odaki <akihiko.odaki@daynix.com>
This function is useful to determine the number of registers exposed to
GDB from the XML name.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231025093128.33116-3-akihiko.odaki@daynix.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-10-alex.bennee@linaro.org>
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index a43aa34dad..7fe00506c7 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -44,6 +44,14 @@ void gdb_register_coprocessor(CPUState *cpu,
*/
int gdbserver_start(const char *port_or_device);
+/**
+ * gdb_find_static_feature() - Find a static feature.
+ * @xmlname: The name of the XML.
+ *
+ * Return: The static feature.
+ */
+const GDBFeature *gdb_find_static_feature(const char *xmlname);
+
void gdb_set_stop_cpu(CPUState *cpu);
/* in gdbstub-xml.c, generated by scripts/feature_to_c.py */
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 29540a0284..ae24c4848f 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -422,6 +422,19 @@ static const char *get_feature_xml(const char *p, const char **newp,
return NULL;
}
+const GDBFeature *gdb_find_static_feature(const char *xmlname)
+{
+ const GDBFeature *feature;
+
+ for (feature = gdb_static_features; feature->xmlname; feature++) {
+ if (!strcmp(feature->xmlname, xmlname)) {
+ return feature;
+ }
+ }
+
+ g_assert_not_reached();
+}
+
static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 10/23] gdbstub: Introduce GDBFeatureBuilder
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (8 preceding siblings ...)
2023-11-07 14:23 ` [PULL 09/23] gdbstub: Introduce gdb_find_static_feature() Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 11/23] cpu: Call plugin hooks only when ready Alex Bennée
` (13 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Richard Henderson, Alex Bennée,
Philippe Mathieu-Daudé
From: Akihiko Odaki <akihiko.odaki@daynix.com>
GDBFeatureBuilder unifies the logic to generate dynamic GDBFeature.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231025093128.33116-4-akihiko.odaki@daynix.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-11-alex.bennee@linaro.org>
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 7fe00506c7..d8a3c56fa2 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -16,6 +16,12 @@ typedef struct GDBFeature {
int num_regs;
} GDBFeature;
+typedef struct GDBFeatureBuilder {
+ GDBFeature *feature;
+ GPtrArray *xml;
+ int base_reg;
+} GDBFeatureBuilder;
+
/* Get or set a register. Returns the size of the register. */
typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg);
@@ -44,6 +50,50 @@ void gdb_register_coprocessor(CPUState *cpu,
*/
int gdbserver_start(const char *port_or_device);
+/**
+ * gdb_feature_builder_init() - Initialize GDBFeatureBuilder.
+ * @builder: The builder to be initialized.
+ * @feature: The feature to be filled.
+ * @name: The name of the feature.
+ * @xmlname: The name of the XML.
+ * @base_reg: The base number of the register ID.
+ */
+void gdb_feature_builder_init(GDBFeatureBuilder *builder, GDBFeature *feature,
+ const char *name, const char *xmlname,
+ int base_reg);
+
+/**
+ * gdb_feature_builder_append_tag() - Append a tag.
+ * @builder: The builder.
+ * @format: The format of the tag.
+ * @...: The values to be formatted.
+ */
+void G_GNUC_PRINTF(2, 3)
+gdb_feature_builder_append_tag(const GDBFeatureBuilder *builder,
+ const char *format, ...);
+
+/**
+ * gdb_feature_builder_append_reg() - Append a register.
+ * @builder: The builder.
+ * @name: The register's name; it must be unique within a CPU.
+ * @bitsize: The register's size, in bits.
+ * @regnum: The offset of the register's number in the feature.
+ * @type: The type of the register.
+ * @group: The register group to which this register belongs; it can be NULL.
+ */
+void gdb_feature_builder_append_reg(const GDBFeatureBuilder *builder,
+ const char *name,
+ int bitsize,
+ int regnum,
+ const char *type,
+ const char *group);
+
+/**
+ * gdb_feature_builder_end() - End building GDBFeature.
+ * @builder: The builder.
+ */
+void gdb_feature_builder_end(const GDBFeatureBuilder *builder);
+
/**
* gdb_find_static_feature() - Find a static feature.
* @xmlname: The name of the XML.
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index ae24c4848f..ebb912da1b 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -422,6 +422,71 @@ static const char *get_feature_xml(const char *p, const char **newp,
return NULL;
}
+void gdb_feature_builder_init(GDBFeatureBuilder *builder, GDBFeature *feature,
+ const char *name, const char *xmlname,
+ int base_reg)
+{
+ char *header = g_markup_printf_escaped(
+ "<?xml version=\"1.0\"?>"
+ "<!DOCTYPE feature SYSTEM \"gdb-target.dtd\">"
+ "<feature name=\"%s\">",
+ name);
+
+ builder->feature = feature;
+ builder->xml = g_ptr_array_new();
+ g_ptr_array_add(builder->xml, header);
+ builder->base_reg = base_reg;
+ feature->xmlname = xmlname;
+ feature->num_regs = 0;
+}
+
+void gdb_feature_builder_append_tag(const GDBFeatureBuilder *builder,
+ const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ g_ptr_array_add(builder->xml, g_markup_vprintf_escaped(format, ap));
+ va_end(ap);
+}
+
+void gdb_feature_builder_append_reg(const GDBFeatureBuilder *builder,
+ const char *name,
+ int bitsize,
+ int regnum,
+ const char *type,
+ const char *group)
+{
+ if (builder->feature->num_regs < regnum) {
+ builder->feature->num_regs = regnum;
+ }
+
+ if (group) {
+ gdb_feature_builder_append_tag(
+ builder,
+ "<reg name=\"%s\" bitsize=\"%d\" regnum=\"%d\" type=\"%s\" group=\"%s\"/>",
+ name, bitsize, builder->base_reg + regnum, type, group);
+ } else {
+ gdb_feature_builder_append_tag(
+ builder,
+ "<reg name=\"%s\" bitsize=\"%d\" regnum=\"%d\" type=\"%s\"/>",
+ name, bitsize, builder->base_reg + regnum, type);
+ }
+}
+
+void gdb_feature_builder_end(const GDBFeatureBuilder *builder)
+{
+ g_ptr_array_add(builder->xml, (void *)"</feature>");
+ g_ptr_array_add(builder->xml, NULL);
+
+ builder->feature->xml = g_strjoinv(NULL, (void *)builder->xml->pdata);
+
+ for (guint i = 0; i < builder->xml->len - 2; i++) {
+ g_free(g_ptr_array_index(builder->xml, i));
+ }
+
+ g_ptr_array_free(builder->xml, TRUE);
+}
+
const GDBFeature *gdb_find_static_feature(const char *xmlname)
{
const GDBFeature *feature;
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 11/23] cpu: Call plugin hooks only when ready
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (9 preceding siblings ...)
2023-11-07 14:23 ` [PULL 10/23] gdbstub: Introduce GDBFeatureBuilder Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 12/23] configure: tell meson and contrib_plugins about DLLTOOL Alex Bennée
` (12 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Alex Bennée, Richard Henderson, Paolo Bonzini
From: Akihiko Odaki <akihiko.odaki@daynix.com>
The initialization and exit hooks will not affect the state of vCPU
outside TCG context, but they may depend on the state of vCPU.
Therefore, it's better to call plugin hooks after the vCPU state is
fully initialized and before it gets uninitialized.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231025093128.33116-16-akihiko.odaki@daynix.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-12-alex.bennee@linaro.org>
diff --git a/cpu-target.c b/cpu-target.c
index 79363ae370..00cd7f4d69 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -42,7 +42,6 @@
#include "hw/core/accel-cpu.h"
#include "trace/trace-root.h"
#include "qemu/accel.h"
-#include "qemu/plugin.h"
uintptr_t qemu_host_page_size;
intptr_t qemu_host_page_mask;
@@ -143,11 +142,6 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
/* Wait until cpu initialization complete before exposing cpu. */
cpu_list_add(cpu);
- /* Plugin initialization must wait until cpu_index assigned. */
- if (tcg_enabled()) {
- qemu_plugin_vcpu_init_hook(cpu);
- }
-
#ifdef CONFIG_USER_ONLY
assert(qdev_get_vmsd(DEVICE(cpu)) == NULL ||
qdev_get_vmsd(DEVICE(cpu))->unmigratable);
@@ -174,11 +168,6 @@ void cpu_exec_unrealizefn(CPUState *cpu)
}
#endif
- /* Call the plugin hook before clearing cpu->cpu_index in cpu_list_remove */
- if (tcg_enabled()) {
- qemu_plugin_vcpu_exit_hook(cpu);
- }
-
cpu_list_remove(cpu);
/*
* Now that the vCPU has been removed from the RCU list, we can call
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index bab8942c30..0acfed4c0f 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -209,6 +209,11 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
cpu_resume(cpu);
}
+ /* Plugin initialization must wait until the cpu is fully realized. */
+ if (tcg_enabled()) {
+ qemu_plugin_vcpu_init_hook(cpu);
+ }
+
/* NOTE: latest generic point where the cpu is fully realized */
}
@@ -216,6 +221,11 @@ static void cpu_common_unrealizefn(DeviceState *dev)
{
CPUState *cpu = CPU(dev);
+ /* Call the plugin hook before clearing the cpu is fully unrealized */
+ if (tcg_enabled()) {
+ qemu_plugin_vcpu_exit_hook(cpu);
+ }
+
/* NOTE: latest generic point before the cpu is fully unrealized */
cpu_exec_unrealizefn(cpu);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 12/23] configure: tell meson and contrib_plugins about DLLTOOL
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (10 preceding siblings ...)
2023-11-07 14:23 ` [PULL 11/23] cpu: Call plugin hooks only when ready Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 13/23] plugins: add dllexport and dllimport to api funcs Alex Bennée
` (11 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Greg Manning, Paolo Bonzini,
Philippe Mathieu-Daudé, Thomas Huth
To cleanly handle cross-building we need to export the details of
dlltool into meson's list of cross binaries and into the
contrib/plugins/ make configuration.
Cc: Greg Manning <gmanning@rapitasystems.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-13-alex.bennee@linaro.org>
diff --git a/configure b/configure
index f1456f6123..cd6c521bd8 100755
--- a/configure
+++ b/configure
@@ -309,6 +309,7 @@ fi
ar="${AR-${cross_prefix}ar}"
as="${AS-${cross_prefix}as}"
ccas="${CCAS-$cc}"
+dlltool="${DLLTOOL-${cross_prefix}dlltool}"
objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}"
@@ -1659,6 +1660,9 @@ echo "SRC_PATH=$source_path/contrib/plugins" >> contrib/plugins/$config_host_mak
echo "PKG_CONFIG=${pkg_config}" >> contrib/plugins/$config_host_mak
echo "CC=$cc $CPU_CFLAGS" >> contrib/plugins/$config_host_mak
echo "CFLAGS=${CFLAGS-$default_cflags} $EXTRA_CFLAGS" >> contrib/plugins/$config_host_mak
+if test "$targetos" = windows; then
+ echo "DLLTOOL=$dlltool" >> contrib/plugins/$config_host_mak
+fi
if test "$targetos" = darwin; then
echo "CONFIG_DARWIN=y" >> contrib/plugins/$config_host_mak
fi
@@ -1764,6 +1768,7 @@ if test "$skip_meson" = no; then
test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
echo "ar = [$(meson_quote $ar)]" >> $cross
+ echo "dlltool = [$(meson_quote $dlltool)]" >> $cross
echo "nm = [$(meson_quote $nm)]" >> $cross
echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross
echo "pkg-config = [$(meson_quote $pkg_config)]" >> $cross
@@ -1869,6 +1874,7 @@ preserve_env CC
preserve_env CFLAGS
preserve_env CXX
preserve_env CXXFLAGS
+preserve_env DLLTOOL
preserve_env LD
preserve_env LDFLAGS
preserve_env LD_LIBRARY_PATH
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 13/23] plugins: add dllexport and dllimport to api funcs
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (11 preceding siblings ...)
2023-11-07 14:23 ` [PULL 12/23] configure: tell meson and contrib_plugins about DLLTOOL Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 14/23] plugins: make test/example plugins work on windows Alex Bennée
` (10 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Greg Manning, Alex Bennée, Paolo Bonzini,
Philippe Mathieu-Daudé
From: Greg Manning <gmanning@rapitasystems.com>
In qemu-plugin.h, mark all API functions as __declspec(dllexport) when
compiling the executables, and as __declspec(dllimport) when being used
to compile plugins against.
Signed-off-by: Greg Manning <gmanning@rapitasystems.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231102172053.17692-2-gmanning@rapitasystems.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20231106185112.2755262-14-alex.bennee@linaro.org>
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 50a9957279..4daab6efd2 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -22,15 +22,18 @@
* https://gcc.gnu.org/wiki/Visibility
*/
#if defined _WIN32 || defined __CYGWIN__
- #ifdef BUILDING_DLL
- #define QEMU_PLUGIN_EXPORT __declspec(dllexport)
- #else
+ #ifdef CONFIG_PLUGIN
#define QEMU_PLUGIN_EXPORT __declspec(dllimport)
+ #define QEMU_PLUGIN_API __declspec(dllexport)
+ #else
+ #define QEMU_PLUGIN_EXPORT __declspec(dllexport)
+ #define QEMU_PLUGIN_API __declspec(dllimport)
#endif
#define QEMU_PLUGIN_LOCAL
#else
#define QEMU_PLUGIN_EXPORT __attribute__((visibility("default")))
#define QEMU_PLUGIN_LOCAL __attribute__((visibility("hidden")))
+ #define QEMU_PLUGIN_API
#endif
/**
@@ -147,6 +150,7 @@ typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index,
*
* Note: Calling this function from qemu_plugin_install() is a bug.
*/
+QEMU_PLUGIN_API
void qemu_plugin_uninstall(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb);
/**
@@ -160,6 +164,7 @@ void qemu_plugin_uninstall(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb);
* Plugins are reset asynchronously, and therefore the given plugin receives
* callbacks until @cb is called.
*/
+QEMU_PLUGIN_API
void qemu_plugin_reset(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb);
/**
@@ -171,6 +176,7 @@ void qemu_plugin_reset(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb);
*
* See also: qemu_plugin_register_vcpu_exit_cb()
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_init_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_simple_cb_t cb);
@@ -183,6 +189,7 @@ void qemu_plugin_register_vcpu_init_cb(qemu_plugin_id_t id,
*
* See also: qemu_plugin_register_vcpu_init_cb()
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_exit_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_simple_cb_t cb);
@@ -193,6 +200,7 @@ void qemu_plugin_register_vcpu_exit_cb(qemu_plugin_id_t id,
*
* The @cb function is called every time a vCPU idles.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_simple_cb_t cb);
@@ -203,6 +211,7 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id,
*
* The @cb function is called every time a vCPU resumes execution.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_simple_cb_t cb);
@@ -253,6 +262,7 @@ typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id,
* callbacks to be triggered when the block or individual instruction
* executes.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_tb_trans_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_tb_trans_cb_t cb);
@@ -265,6 +275,7 @@ void qemu_plugin_register_vcpu_tb_trans_cb(qemu_plugin_id_t id,
*
* The @cb function is called every time a translated unit executes.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb,
qemu_plugin_vcpu_udata_cb_t cb,
enum qemu_plugin_cb_flags flags,
@@ -296,6 +307,7 @@ enum qemu_plugin_op {
* Note: ops are not atomic so in multi-threaded/multi-smp situations
* you will get inexact results.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb,
enum qemu_plugin_op op,
void *ptr, uint64_t imm);
@@ -309,6 +321,7 @@ void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb,
*
* The @cb function is called every time an instruction is executed
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn,
qemu_plugin_vcpu_udata_cb_t cb,
enum qemu_plugin_cb_flags flags,
@@ -324,6 +337,7 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn,
* Insert an inline op to every time an instruction executes. Useful
* if you just want to increment a single counter somewhere in memory.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn,
enum qemu_plugin_op op,
void *ptr, uint64_t imm);
@@ -334,6 +348,7 @@ void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn,
*
* Returns: number of instructions in this block
*/
+QEMU_PLUGIN_API
size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb);
/**
@@ -342,6 +357,7 @@ size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb);
*
* Returns: virtual address of block start
*/
+QEMU_PLUGIN_API
uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb);
/**
@@ -355,6 +371,7 @@ uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb);
*
* Returns: opaque handle to instruction
*/
+QEMU_PLUGIN_API
struct qemu_plugin_insn *
qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx);
@@ -368,6 +385,7 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx);
* Returns: pointer to a stream of bytes containing the value of this
* instructions opcode.
*/
+QEMU_PLUGIN_API
const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn);
/**
@@ -376,6 +394,7 @@ const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn);
*
* Returns: size of instruction in bytes
*/
+QEMU_PLUGIN_API
size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn);
/**
@@ -384,6 +403,7 @@ size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn);
*
* Returns: virtual address of instruction
*/
+QEMU_PLUGIN_API
uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn);
/**
@@ -392,6 +412,7 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn);
*
* Returns: hardware (physical) target address of instruction
*/
+QEMU_PLUGIN_API
void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn);
/**
@@ -410,6 +431,7 @@ struct qemu_plugin_hwaddr;
*
* Returns: size of access in ^2 (0=byte, 1=16bit, 2=32bit etc...)
*/
+QEMU_PLUGIN_API
unsigned int qemu_plugin_mem_size_shift(qemu_plugin_meminfo_t info);
/**
* qemu_plugin_mem_is_sign_extended() - was the access sign extended
@@ -417,6 +439,7 @@ unsigned int qemu_plugin_mem_size_shift(qemu_plugin_meminfo_t info);
*
* Returns: true if it was, otherwise false
*/
+QEMU_PLUGIN_API
bool qemu_plugin_mem_is_sign_extended(qemu_plugin_meminfo_t info);
/**
* qemu_plugin_mem_is_big_endian() - was the access big endian
@@ -424,6 +447,7 @@ bool qemu_plugin_mem_is_sign_extended(qemu_plugin_meminfo_t info);
*
* Returns: true if it was, otherwise false
*/
+QEMU_PLUGIN_API
bool qemu_plugin_mem_is_big_endian(qemu_plugin_meminfo_t info);
/**
* qemu_plugin_mem_is_store() - was the access a store
@@ -431,6 +455,7 @@ bool qemu_plugin_mem_is_big_endian(qemu_plugin_meminfo_t info);
*
* Returns: true if it was, otherwise false
*/
+QEMU_PLUGIN_API
bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info);
/**
@@ -446,6 +471,7 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info);
* information about the handle should be recovered before the
* callback returns.
*/
+QEMU_PLUGIN_API
struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
uint64_t vaddr);
@@ -462,6 +488,7 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
* Returns true if the handle's memory operation is to memory-mapped IO, or
* false if it is to RAM
*/
+QEMU_PLUGIN_API
bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr);
/**
@@ -473,12 +500,14 @@ bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr);
* Note that the returned physical address may not be unique if you are dealing
* with multiple address spaces.
*/
+QEMU_PLUGIN_API
uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr);
/*
* Returns a string representing the device. The string is valid for
* the lifetime of the plugin.
*/
+QEMU_PLUGIN_API
const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h);
/**
@@ -513,6 +542,7 @@ typedef void (*qemu_plugin_vcpu_mem_cb_t) (unsigned int vcpu_index,
* callback so the plugin is responsible for ensuring it doesn't get
* confused by making appropriate use of locking if required.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn,
qemu_plugin_vcpu_mem_cb_t cb,
enum qemu_plugin_cb_flags flags,
@@ -531,6 +561,7 @@ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn,
* instruction. This provides for a lightweight but not thread-safe
* way of counting the number of operations done.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn,
enum qemu_plugin_mem_rw rw,
enum qemu_plugin_op op, void *ptr,
@@ -544,6 +575,7 @@ typedef void
uint64_t a3, uint64_t a4, uint64_t a5,
uint64_t a6, uint64_t a7, uint64_t a8);
+QEMU_PLUGIN_API
void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_syscall_cb_t cb);
@@ -551,6 +583,7 @@ typedef void
(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx,
int64_t num, int64_t ret);
+QEMU_PLUGIN_API
void
qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id,
qemu_plugin_vcpu_syscall_ret_cb_t cb);
@@ -563,6 +596,7 @@ qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id,
* Returns an allocated string containing the disassembly
*/
+QEMU_PLUGIN_API
char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn);
/**
@@ -572,6 +606,7 @@ char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn);
* Return a static string referring to the symbol. This is dependent
* on the binary QEMU is running having provided a symbol table.
*/
+QEMU_PLUGIN_API
const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn);
/**
@@ -583,9 +618,11 @@ const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn);
*
* See also: qemu_plugin_register_vcpu_init_cb()
*/
+QEMU_PLUGIN_API
void qemu_plugin_vcpu_for_each(qemu_plugin_id_t id,
qemu_plugin_vcpu_simple_cb_t cb);
+QEMU_PLUGIN_API
void qemu_plugin_register_flush_cb(qemu_plugin_id_t id,
qemu_plugin_simple_cb_t cb);
@@ -602,6 +639,7 @@ void qemu_plugin_register_flush_cb(qemu_plugin_id_t id,
* In user-mode it is possible a few un-instrumented instructions from
* child threads may run before the host kernel reaps the threads.
*/
+QEMU_PLUGIN_API
void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id,
qemu_plugin_udata_cb_t cb, void *userdata);
@@ -615,6 +653,7 @@ int qemu_plugin_n_max_vcpus(void);
* qemu_plugin_outs() - output string via QEMU's logging system
* @string: a string
*/
+QEMU_PLUGIN_API
void qemu_plugin_outs(const char *string);
/**
@@ -628,6 +667,7 @@ void qemu_plugin_outs(const char *string);
* returns true if the combination @name=@val parses correctly to a boolean
* argument, and false otherwise
*/
+QEMU_PLUGIN_API
bool qemu_plugin_bool_parse(const char *name, const char *val, bool *ret);
/**
@@ -638,6 +678,7 @@ bool qemu_plugin_bool_parse(const char *name, const char *val, bool *ret);
* return NULL. The user should g_free() the string once no longer
* needed.
*/
+QEMU_PLUGIN_API
const char *qemu_plugin_path_to_binary(void);
/**
@@ -646,6 +687,7 @@ const char *qemu_plugin_path_to_binary(void);
* Returns the nominal start address of the main text segment in
* user-mode. Currently returns 0 for system emulation.
*/
+QEMU_PLUGIN_API
uint64_t qemu_plugin_start_code(void);
/**
@@ -654,6 +696,7 @@ uint64_t qemu_plugin_start_code(void);
* Returns the nominal end address of the main text segment in
* user-mode. Currently returns 0 for system emulation.
*/
+QEMU_PLUGIN_API
uint64_t qemu_plugin_end_code(void);
/**
@@ -662,6 +705,7 @@ uint64_t qemu_plugin_end_code(void);
* Returns the nominal entry address of the main text segment in
* user-mode. Currently returns 0 for system emulation.
*/
+QEMU_PLUGIN_API
uint64_t qemu_plugin_entry_code(void);
#endif /* QEMU_QEMU_PLUGIN_H */
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 14/23] plugins: make test/example plugins work on windows
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (12 preceding siblings ...)
2023-11-07 14:23 ` [PULL 13/23] plugins: add dllexport and dllimport to api funcs Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 15/23] plugins: disable lockstep plugin " Alex Bennée
` (9 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Greg Manning, Alex Bennée, Paolo Bonzini, Thomas Huth,
Alexandre Iooss, Mahmoud Mandour
From: Greg Manning <gmanning@rapitasystems.com>
Generate a qemu_plugin_api.lib delay import lib on windows, for
windows qemu plugins to link against.
Implement an example dll load fail hook to link up the API functions
correctly when a plugin is loaded on windows.
Update the build scripts for the test and example plugins to use these
things.
Signed-off-by: Greg Manning <gmanning@rapitasystems.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231102172053.17692-3-gmanning@rapitasystems.com>
[AJB: use find_program for dlltool, s/Windows/windows/]
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-15-alex.bennee@linaro.org>
diff --git a/configure b/configure
index cd6c521bd8..e50ec99fe2 100755
--- a/configure
+++ b/configure
@@ -1666,6 +1666,9 @@ fi
if test "$targetos" = darwin; then
echo "CONFIG_DARWIN=y" >> contrib/plugins/$config_host_mak
fi
+if test "$targetos" = windows; then
+ echo "CONFIG_WIN32=y" >> contrib/plugins/$config_host_mak
+fi
# tests/tcg configuration
(config_host_mak=tests/tcg/config-host.mak
diff --git a/contrib/plugins/win32_linker.c b/contrib/plugins/win32_linker.c
new file mode 100644
index 0000000000..7534b2b8bf
--- /dev/null
+++ b/contrib/plugins/win32_linker.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2023, Greg Manning <gmanning@rapitasystems.com>
+ *
+ * This hook, __pfnDliFailureHook2, is documented in the microsoft documentation here:
+ * https://learn.microsoft.com/en-us/cpp/build/reference/error-handling-and-notification
+ * It gets called when a delay-loaded DLL encounters various errors.
+ * We handle the specific case of a DLL looking for a "qemu.exe",
+ * and give it the running executable (regardless of what it is named).
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ */
+
+#include <windows.h>
+#include <delayimp.h>
+
+FARPROC WINAPI dll_failure_hook(unsigned dliNotify, PDelayLoadInfo pdli);
+
+
+PfnDliHook __pfnDliFailureHook2 = dll_failure_hook;
+
+FARPROC WINAPI dll_failure_hook(unsigned dliNotify, PDelayLoadInfo pdli) {
+ if (dliNotify == dliFailLoadLib) {
+ /* If the failing request was for qemu.exe, ... */
+ if (strcmp(pdli->szDll, "qemu.exe") == 0) {
+ /* Then pass back a pointer to the top level module. */
+ HMODULE top = GetModuleHandle(NULL);
+ return (FARPROC) top;
+ }
+ }
+ /* Otherwise we can't do anything special. */
+ return 0;
+}
+
diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index 8ba78c7a32..751fa38619 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -22,7 +22,14 @@ NAMES += hwprofile
NAMES += cache
NAMES += drcov
-SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
+ifeq ($(CONFIG_WIN32),y)
+SO_SUFFIX := .dll
+LDLIBS += $(shell $(PKG_CONFIG) --libs glib-2.0)
+else
+SO_SUFFIX := .so
+endif
+
+SONAMES := $(addsuffix $(SO_SUFFIX),$(addprefix lib,$(NAMES)))
# The main QEMU uses Glib extensively so it's perfectly fine to use it
# in plugins (which many example do).
@@ -35,15 +42,20 @@ all: $(SONAMES)
%.o: %.c
$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
-lib%.so: %.o
-ifeq ($(CONFIG_DARWIN),y)
+ifeq ($(CONFIG_WIN32),y)
+lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/qemu_plugin_api.lib
+ $(CC) -shared -o $@ $^ $(LDLIBS)
+else ifeq ($(CONFIG_DARWIN),y)
+lib%$(SO_SUFFIX): %.o
$(CC) -bundle -Wl,-undefined,dynamic_lookup -o $@ $^ $(LDLIBS)
else
+lib%$(SO_SUFFIX): %.o
$(CC) -shared -o $@ $^ $(LDLIBS)
endif
+
clean:
- rm -f *.o *.so *.d
+ rm -f *.o *$(SO_SUFFIX) *.d
rm -Rf .libs
.PHONY: all clean
diff --git a/plugins/meson.build b/plugins/meson.build
index 71ed996ed3..40d24529c0 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -14,6 +14,25 @@ if not enable_modules
endif
if get_option('plugins')
+ if targetos == 'windows'
+ dlltool = find_program('dlltool', required: true)
+
+ # Generate a .lib file for plugins to link against.
+ # First, create a .def file listing all the symbols a plugin should expect to have
+ # available in qemu
+ win32_plugin_def = configure_file(
+ input: files('qemu-plugins.symbols'),
+ output: 'qemu_plugin_api.def',
+ capture: true,
+ command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@'])
+ # then use dlltool to assemble a delaylib.
+ win32_qemu_plugin_api_lib = configure_file(
+ input: win32_plugin_def,
+ output: 'qemu_plugin_api.lib',
+ command: [dlltool, '--input-def', '@INPUT@',
+ '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
+ )
+ endif
specific_ss.add(files(
'loader.c',
'core.c',
diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build
index 322cafcdf6..528bb9d86c 100644
--- a/tests/plugin/meson.build
+++ b/tests/plugin/meson.build
@@ -1,9 +1,17 @@
t = []
if get_option('plugins')
foreach i : ['bb', 'empty', 'insn', 'mem', 'syscall']
- t += shared_module(i, files(i + '.c'),
- include_directories: '../../include/qemu',
- dependencies: glib)
+ if targetos == 'windows'
+ t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
+ include_directories: '../../include/qemu',
+ objects: [win32_qemu_plugin_api_lib],
+ dependencies: glib)
+
+ else
+ t += shared_module(i, files(i + '.c'),
+ include_directories: '../../include/qemu',
+ dependencies: glib)
+ endif
endforeach
endif
if t.length() > 0
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 15/23] plugins: disable lockstep plugin on windows
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (13 preceding siblings ...)
2023-11-07 14:23 ` [PULL 14/23] plugins: make test/example plugins work on windows Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 16/23] gitlab: add dlltool to Windows CI Alex Bennée
` (8 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Greg Manning, Alex Bennée, Philippe Mathieu-Daudé,
Alexandre Iooss, Mahmoud Mandour
From: Greg Manning <gmanning@rapitasystems.com>
The lockstep plugin uses unix sockets and would require a different
communication mechanism to work on Windows.
Signed-off-by: Greg Manning <gmanning@rapitasystems.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231102172053.17692-4-gmanning@rapitasystems.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-16-alex.bennee@linaro.org>
diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index 751fa38619..1783750cf6 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -17,7 +17,13 @@ NAMES += execlog
NAMES += hotblocks
NAMES += hotpages
NAMES += howvec
+
+# The lockstep example communicates using unix sockets,
+# and can't be easily made to work on windows.
+ifneq ($(CONFIG_WIN32),y)
NAMES += lockstep
+endif
+
NAMES += hwprofile
NAMES += cache
NAMES += drcov
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 16/23] gitlab: add dlltool to Windows CI
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (14 preceding siblings ...)
2023-11-07 14:23 ` [PULL 15/23] plugins: disable lockstep plugin " Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 17/23] plugins: allow plugins to be enabled on windows Alex Bennée
` (7 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Yonggang Luo, Philippe Mathieu-Daudé,
Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml
index 12a987cd71..f7645f72b7 100644
--- a/.gitlab-ci.d/windows.yml
+++ b/.gitlab-ci.d/windows.yml
@@ -72,6 +72,7 @@
- .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
bison diffutils flex
git grep make sed
+ $MINGW_TARGET-binutils
$MINGW_TARGET-capstone
$MINGW_TARGET-ccache
$MINGW_TARGET-curl
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 17/23] plugins: allow plugins to be enabled on windows
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (15 preceding siblings ...)
2023-11-07 14:23 ` [PULL 16/23] gitlab: add dlltool to Windows CI Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 18/23] contrib/gitdm: Add Rivos Inc to the domain map Alex Bennée
` (6 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Greg Manning, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Thomas Huth, Marc-André Lureau,
Daniel P. Berrangé
From: Greg Manning <gmanning@rapitasystems.com>
allow plugins to be enabled in the configure script on windows. Also,
add the qemu_plugin_api.lib to the installer.
Signed-off-by: Greg Manning <gmanning@rapitasystems.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231102172053.17692-5-gmanning@rapitasystems.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[AJB: add check for dlltool to configure]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-17-alex.bennee@linaro.org>
diff --git a/configure b/configure
index e50ec99fe2..abcb199aa8 100755
--- a/configure
+++ b/configure
@@ -1011,9 +1011,9 @@ if test "$targetos" = "bogus"; then
fi
# test for any invalid configuration combinations
-if test "$targetos" = "windows"; then
+if test "$targetos" = "windows" && ! has "$dlltool"; then
if test "$plugins" = "yes"; then
- error_exit "TCG plugins not currently supported on Windows platforms"
+ error_exit "TCG plugins requires dlltool to build on Windows platforms"
fi
plugins="no"
fi
diff --git a/meson.build b/meson.build
index 4848930680..d7d841e71e 100644
--- a/meson.build
+++ b/meson.build
@@ -3944,6 +3944,11 @@ endforeach
if get_option('plugins')
install_headers('include/qemu/qemu-plugin.h')
+ if targetos == 'windows'
+ # On windows, we want to deliver the qemu_plugin_api.lib file in the qemu installer,
+ # so that plugin authors can compile against it.
+ install_data(win32_qemu_plugin_api_lib, install_dir: 'lib')
+ endif
endif
subdir('qga')
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 18/23] contrib/gitdm: Add Rivos Inc to the domain map
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (16 preceding siblings ...)
2023-11-07 14:23 ` [PULL 17/23] plugins: allow plugins to be enabled on windows Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 19/23] contrib/gitdm: add domain-map for Cestc Alex Bennée
` (5 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Palmer Dabbelt
Whatever they are up to a number of people for the company are
contributing to QEMU so lets group them together.
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-18-alex.bennee@linaro.org>
diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map
index 3e31a06245..e676da8d47 100644
--- a/contrib/gitdm/domain-map
+++ b/contrib/gitdm/domain-map
@@ -38,6 +38,7 @@ proxmox.com Proxmox
quicinc.com Qualcomm Innovation Center
redhat.com Red Hat
rev.ng rev.ng Labs
+rivosinc.com Rivos Inc
rt-rk.com RT-RK
samsung.com Samsung
siemens.com Siemens
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 19/23] contrib/gitdm: add domain-map for Cestc
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (17 preceding siblings ...)
2023-11-07 14:23 ` [PULL 18/23] contrib/gitdm: Add Rivos Inc to the domain map Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 20/23] contrib/gitdm: map HiSilicon to Huawei Alex Bennée
` (4 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel; +Cc: luzhipeng, Alex Bennée
From: luzhipeng <luzhipeng@cestc.cn>
Signed-off-by: luzhipeng <luzhipeng@cestc.cn>
Message-Id: <20230628072236.1925-1-luzhipeng@cestc.cn>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-19-alex.bennee@linaro.org>
diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map
index e676da8d47..38945cddf0 100644
--- a/contrib/gitdm/domain-map
+++ b/contrib/gitdm/domain-map
@@ -12,6 +12,7 @@ amd.com AMD
aspeedtech.com ASPEED Technology Inc.
baidu.com Baidu
bytedance.com ByteDance
+cestc.cn Cestc
cmss.chinamobile.com China Mobile
citrix.com Citrix
crudebyte.com Crudebyte
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 20/23] contrib/gitdm: map HiSilicon to Huawei
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (18 preceding siblings ...)
2023-11-07 14:23 ` [PULL 19/23] contrib/gitdm: add domain-map for Cestc Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 21/23] contrib/gitdm: add Daynix to domain-map Alex Bennée
` (3 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Yicong Yang
HiSilicon is a wholly owned subsidiary of Huawei so map the domain to
the same company to avoid splitting the contributions.
Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-20-alex.bennee@linaro.org>
diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map
index 38945cddf0..42571fc1c4 100644
--- a/contrib/gitdm/domain-map
+++ b/contrib/gitdm/domain-map
@@ -22,6 +22,7 @@ fb.com Facebook
fujitsu.com Fujitsu
google.com Google
greensocs.com GreenSocs
+hisilicon.com Huawei
huawei.com Huawei
ibm.com IBM
igalia.com Igalia
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 21/23] contrib/gitdm: add Daynix to domain-map
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (19 preceding siblings ...)
2023-11-07 14:23 ` [PULL 20/23] contrib/gitdm: map HiSilicon to Huawei Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 22/23] mailmap: fixup some more corrupted author fields Alex Bennée
` (2 subsequent siblings)
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Akihiko Odaki
Daynix describes itself as a cloud technology company so I assume
employee contributions should count as such.
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-21-alex.bennee@linaro.org>
diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map
index 42571fc1c4..bf1dce03fd 100644
--- a/contrib/gitdm/domain-map
+++ b/contrib/gitdm/domain-map
@@ -17,6 +17,7 @@ cmss.chinamobile.com China Mobile
citrix.com Citrix
crudebyte.com Crudebyte
chinatelecom.cn China Telecom
+daynix.com Daynix
eldorado.org.br Instituto de Pesquisas Eldorado
fb.com Facebook
fujitsu.com Fujitsu
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 22/23] mailmap: fixup some more corrupted author fields
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (20 preceding siblings ...)
2023-11-07 14:23 ` [PULL 21/23] contrib/gitdm: add Daynix to domain-map Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-07 14:23 ` [PULL 23/23] Revert "tests/tcg/nios2: Re-enable linux-user tests" Alex Bennée
2023-11-08 12:36 ` [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Stefan Hajnoczi
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Philippe Mathieu-Daudé,
Timothée Cocault, fanwenjie
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Timothée Cocault <timothee.cocault@gmail.com>
Cc: fanwenjie <fanwj@mail.ustc.edu.cn>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-22-alex.bennee@linaro.org>
diff --git a/.mailmap b/.mailmap
index 94f19a0ac9..e12e19f691 100644
--- a/.mailmap
+++ b/.mailmap
@@ -30,10 +30,12 @@ malc <av1474@comtv.ru> malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
# Corrupted Author fields
Aaron Larson <alarson@ddci.com> alarson@ddci.com
Andreas Färber <andreas.faerber@web.de> Andreas Färber <andreas.faerber>
+fanwenjie <fanwj@mail.ustc.edu.cn> fanwj@mail.ustc.edu.cn <fanwj@mail.ustc.edu.cn>
Jason Wang <jasowang@redhat.com> Jason Wang <jasowang>
Marek Dolata <mkdolata@us.ibm.com> mkdolata@us.ibm.com <mkdolata@us.ibm.com>
Michael Ellerman <mpe@ellerman.id.au> michael@ozlabs.org <michael@ozlabs.org>
Nick Hudson <hnick@vmware.com> hnick@vmware.com <hnick@vmware.com>
+Timothée Cocault <timothee.cocault@gmail.com> timothee.cocault@gmail.com <timothee.cocault@gmail.com>
# There is also a:
# (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162>
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PULL 23/23] Revert "tests/tcg/nios2: Re-enable linux-user tests"
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (21 preceding siblings ...)
2023-11-07 14:23 ` [PULL 22/23] mailmap: fixup some more corrupted author fields Alex Bennée
@ 2023-11-07 14:23 ` Alex Bennée
2023-11-08 12:36 ` [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Stefan Hajnoczi
23 siblings, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-07 14:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Chris Wulff, Marek Vasut, Richard Henderson
nios2 signal tests are broken again:
retry.py -n 10 -c -- ./qemu-nios2 ./tests/tcg/nios2-linux-user/signals
Results summary:
0: 8 times (80.00%), avg time 2.254 (0.00 varience/0.00 deviation)
-11: 2 times (20.00%), avg time 0.253 (0.00 varience/0.00 deviation)
Ran command 10 times, 8 passes
This wasn't picked up by CI as we don't have a docker container that
can build QEMU with the nios2 compiler. I don't have time to bisect
the breakage and the target is orphaned anyway so take the easy route
and revert it.
This reverts commit 20e7524ff9f0cab4c9a0306014d6f3d7b467ae1e.
Cc: Chris Wulff <crwulff@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231106185112.2755262-23-alex.bennee@linaro.org>
diff --git a/tests/tcg/nios2/Makefile.target b/tests/tcg/nios2/Makefile.target
new file mode 100644
index 0000000000..b38e2352b7
--- /dev/null
+++ b/tests/tcg/nios2/Makefile.target
@@ -0,0 +1,11 @@
+# nios2 specific test tweaks
+
+# Currently nios2 signal handling is broken
+run-signals: signals
+ $(call skip-test, $<, "BROKEN")
+run-plugin-signals-with-%:
+ $(call skip-test, $<, "BROKEN")
+run-linux-test: linux-test
+ $(call skip-test, $<, "BROKEN")
+run-plugin-linux-test-with-%:
+ $(call skip-test, $<, "BROKEN")
--
2.39.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2
2023-11-07 14:23 [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Alex Bennée
` (22 preceding siblings ...)
2023-11-07 14:23 ` [PULL 23/23] Revert "tests/tcg/nios2: Re-enable linux-user tests" Alex Bennée
@ 2023-11-08 12:36 ` Stefan Hajnoczi
2023-11-08 14:56 ` Alex Bennée
2023-11-08 15:54 ` Alex Bennée
23 siblings, 2 replies; 31+ messages in thread
From: Stefan Hajnoczi @ 2023-11-08 12:36 UTC (permalink / raw)
To: Alex Bennée; +Cc: qemu-devel
On Tue, 7 Nov 2023 at 22:25, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit 462ad017ed76889d46696a3581e1b52343f9b683:
>
> Merge tag 'pixman-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2023-11-07 19:00:03 +0800)
>
> are available in the Git repository at:
>
> https://gitlab.com/stsquad/qemu.git tags/pull-halloween-omnibus-071123-1
>
> for you to fetch changes up to 00da668de6856d912cd75474ba759927e29d0e49:
>
> Revert "tests/tcg/nios2: Re-enable linux-user tests" (2023-11-07 14:18:29 +0000)
>
> ----------------------------------------------------------------
> Final test, gdbstub, plugin and gitdm updates for 8.2
>
> - fix duplicate register in arm xml
> - hide various duplicate system registers from gdbstub
> - add new gdb register test to the CI (skipping s390x/ppc64 for now)
> - introduce GDBFeatureBuilder
> - move plugin initialisation to after vCPU init completes
> - enable building TCG plugins on Windows platform
Hi Alex,
Please take a look at the following CI failure:
i686-w64-mingw32-gcc -m32 -o tests/plugin/libempty.dll
plugins/qemu_plugin_api.lib tests/plugin/libempty.dll.p/empty.c.obj
tests/plugin/libempty.dll.p/.._.._contrib_plugins_win32_linker.c.obj
-Wl,--allow-shlib-undefined -shared -Wl,--start-group
-Wl,--out-implib=tests/plugin/libempty.dll.a -fstack-protector-strong
-Wl,--no-seh -Wl,--nxcompat -Wl,--dynamicbase -Wl,--warn-common
/usr/i686-w64-mingw32/sys-root/mingw/lib/libglib-2.0.dll.a
/usr/i686-w64-mingw32/sys-root/mingw/lib/libintl.dll.a
/usr/i686-w64-mingw32/sys-root/mingw/lib/libgmodule-2.0.dll.a
-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32
-luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
/usr/lib/gcc/i686-w64-mingw32/12.2.1/../../../../i686-w64-mingw32/bin/ld:
tests/plugin/libempty.dll.p/empty.c.obj: in function
`qemu_plugin_install':
/builds/qemu-project/qemu/build/../tests/plugin/empty.c:30: undefined
reference to `_imp__qemu_plugin_register_vcpu_tb_trans_cb'
collect2: error: ld returned 1 exit status
https://gitlab.com/qemu-project/qemu/-/jobs/5487689202
Thanks,
Stefan
> - various gitdm updates
> - some mailmap fixes
> - disable testing for nios2 signals which have regressed
>
> ----------------------------------------------------------------
> Akihiko Odaki (5):
> default-configs: Add TARGET_XML_FILES definition
> gdbstub: Add num_regs member to GDBFeature
> gdbstub: Introduce gdb_find_static_feature()
> gdbstub: Introduce GDBFeatureBuilder
> cpu: Call plugin hooks only when ready
>
> Alex Bennée (13):
> gdb-xml: fix duplicate register in arm-neon.xml
> target/arm: mark the 32bit alias of PAR when LPAE enabled
> target/arm: hide all versions of DBGD[RS]AR from gdbstub
> target/arm: hide aliased MIDR from gdbstub
> tests/tcg: add an explicit gdbstub register tester
> tests/avocado: update the tcg_plugins test
> configure: tell meson and contrib_plugins about DLLTOOL
> gitlab: add dlltool to Windows CI
> contrib/gitdm: Add Rivos Inc to the domain map
> contrib/gitdm: map HiSilicon to Huawei
> contrib/gitdm: add Daynix to domain-map
> mailmap: fixup some more corrupted author fields
> Revert "tests/tcg/nios2: Re-enable linux-user tests"
>
> Greg Manning (4):
> plugins: add dllexport and dllimport to api funcs
> plugins: make test/example plugins work on windows
> plugins: disable lockstep plugin on windows
> plugins: allow plugins to be enabled on windows
>
> luzhipeng (1):
> contrib/gitdm: add domain-map for Cestc
>
> MAINTAINERS | 2 +-
> configure | 13 +-
> configs/targets/loongarch64-linux-user.mak | 1 +
> meson.build | 5 +
> include/exec/gdbstub.h | 59 ++++++
> include/qemu/qemu-plugin.h | 50 +++++-
> contrib/plugins/win32_linker.c | 34 ++++
> cpu-target.c | 11 --
> gdbstub/gdbstub.c | 78 ++++++++
> hw/core/cpu-common.c | 10 ++
> target/arm/debug_helper.c | 10 +-
> target/arm/helper.c | 37 ++--
> .gitlab-ci.d/windows.yml | 1 +
> .mailmap | 2 +
> contrib/gitdm/domain-map | 4 +
> contrib/plugins/Makefile | 26 ++-
> gdb-xml/arm-neon.xml | 2 +-
> plugins/meson.build | 19 ++
> scripts/feature_to_c.py | 46 ++++-
> tests/avocado/tcg_plugins.py | 28 +--
> tests/plugin/meson.build | 14 +-
> tests/tcg/multiarch/Makefile.target | 11 +-
> tests/tcg/multiarch/gdbstub/registers.py | 197 +++++++++++++++++++++
> tests/tcg/multiarch/system/Makefile.softmmu-target | 13 +-
> tests/tcg/nios2/Makefile.target | 11 ++
> tests/tcg/ppc64/Makefile.target | 7 +
> tests/tcg/s390x/Makefile.target | 4 +
> 27 files changed, 637 insertions(+), 58 deletions(-)
> create mode 100644 contrib/plugins/win32_linker.c
> create mode 100644 tests/tcg/multiarch/gdbstub/registers.py
> create mode 100644 tests/tcg/nios2/Makefile.target
>
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2
2023-11-08 12:36 ` [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Stefan Hajnoczi
@ 2023-11-08 14:56 ` Alex Bennée
2023-11-08 15:54 ` Alex Bennée
1 sibling, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-08 14:56 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Greg Manning
Stefan Hajnoczi <stefanha@gmail.com> writes:
> On Tue, 7 Nov 2023 at 22:25, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> The following changes since commit 462ad017ed76889d46696a3581e1b52343f9b683:
>>
>> Merge tag 'pixman-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2023-11-07 19:00:03 +0800)
>>
>> are available in the Git repository at:
>>
>> https://gitlab.com/stsquad/qemu.git tags/pull-halloween-omnibus-071123-1
>>
>> for you to fetch changes up to 00da668de6856d912cd75474ba759927e29d0e49:
>>
>> Revert "tests/tcg/nios2: Re-enable linux-user tests" (2023-11-07 14:18:29 +0000)
>>
>> ----------------------------------------------------------------
>> Final test, gdbstub, plugin and gitdm updates for 8.2
>>
>> - fix duplicate register in arm xml
>> - hide various duplicate system registers from gdbstub
>> - add new gdb register test to the CI (skipping s390x/ppc64 for now)
>> - introduce GDBFeatureBuilder
>> - move plugin initialisation to after vCPU init completes
>> - enable building TCG plugins on Windows platform
>
> Hi Alex,
> Please take a look at the following CI failure:
>
> i686-w64-mingw32-gcc -m32 -o tests/plugin/libempty.dll
> plugins/qemu_plugin_api.lib tests/plugin/libempty.dll.p/empty.c.obj
> tests/plugin/libempty.dll.p/.._.._contrib_plugins_win32_linker.c.obj
> -Wl,--allow-shlib-undefined -shared -Wl,--start-group
> -Wl,--out-implib=tests/plugin/libempty.dll.a -fstack-protector-strong
> -Wl,--no-seh -Wl,--nxcompat -Wl,--dynamicbase -Wl,--warn-common
> /usr/i686-w64-mingw32/sys-root/mingw/lib/libglib-2.0.dll.a
> /usr/i686-w64-mingw32/sys-root/mingw/lib/libintl.dll.a
> /usr/i686-w64-mingw32/sys-root/mingw/lib/libgmodule-2.0.dll.a
> -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32
> -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
> /usr/lib/gcc/i686-w64-mingw32/12.2.1/../../../../i686-w64-mingw32/bin/ld:
> tests/plugin/libempty.dll.p/empty.c.obj: in function
> `qemu_plugin_install':
> /builds/qemu-project/qemu/build/../tests/plugin/empty.c:30: undefined
> reference to `_imp__qemu_plugin_register_vcpu_tb_trans_cb'
> collect2: error: ld returned 1 exit status
Sorry I missed that. While the native msys2-win32bit/msys2-win64bit
builds work the mingw cross builds fail despite having dlltool
installed.
For now I shall --disable-plugins on those builds and raise a bug to
make sure we don't forget.
Greg,
Do you have a Linux/WSL2 system as well that you could look at the
difference? It seems weird its only complaining about some of the
symbols.
To do a local mingw cross build in Linux:
make docker-test-build@fedora-win64-cross J=30 V=1 EXTRA_CONFIGURE_OPTS="--enable-fdt=internal" NETWORK=1 DEBUG=1
The NETWORK is important to ensure git can fetch stuff. DEBUG will drop
you into a shell inside the container so you can poke around the build.
>
> https://gitlab.com/qemu-project/qemu/-/jobs/5487689202
>
> Thanks,
> Stefan
>
>> - various gitdm updates
>> - some mailmap fixes
>> - disable testing for nios2 signals which have regressed
>>
>> ----------------------------------------------------------------
>> Akihiko Odaki (5):
>> default-configs: Add TARGET_XML_FILES definition
>> gdbstub: Add num_regs member to GDBFeature
>> gdbstub: Introduce gdb_find_static_feature()
>> gdbstub: Introduce GDBFeatureBuilder
>> cpu: Call plugin hooks only when ready
>>
>> Alex Bennée (13):
>> gdb-xml: fix duplicate register in arm-neon.xml
>> target/arm: mark the 32bit alias of PAR when LPAE enabled
>> target/arm: hide all versions of DBGD[RS]AR from gdbstub
>> target/arm: hide aliased MIDR from gdbstub
>> tests/tcg: add an explicit gdbstub register tester
>> tests/avocado: update the tcg_plugins test
>> configure: tell meson and contrib_plugins about DLLTOOL
>> gitlab: add dlltool to Windows CI
>> contrib/gitdm: Add Rivos Inc to the domain map
>> contrib/gitdm: map HiSilicon to Huawei
>> contrib/gitdm: add Daynix to domain-map
>> mailmap: fixup some more corrupted author fields
>> Revert "tests/tcg/nios2: Re-enable linux-user tests"
>>
>> Greg Manning (4):
>> plugins: add dllexport and dllimport to api funcs
>> plugins: make test/example plugins work on windows
>> plugins: disable lockstep plugin on windows
>> plugins: allow plugins to be enabled on windows
>>
>> luzhipeng (1):
>> contrib/gitdm: add domain-map for Cestc
>>
>> MAINTAINERS | 2 +-
>> configure | 13 +-
>> configs/targets/loongarch64-linux-user.mak | 1 +
>> meson.build | 5 +
>> include/exec/gdbstub.h | 59 ++++++
>> include/qemu/qemu-plugin.h | 50 +++++-
>> contrib/plugins/win32_linker.c | 34 ++++
>> cpu-target.c | 11 --
>> gdbstub/gdbstub.c | 78 ++++++++
>> hw/core/cpu-common.c | 10 ++
>> target/arm/debug_helper.c | 10 +-
>> target/arm/helper.c | 37 ++--
>> .gitlab-ci.d/windows.yml | 1 +
>> .mailmap | 2 +
>> contrib/gitdm/domain-map | 4 +
>> contrib/plugins/Makefile | 26 ++-
>> gdb-xml/arm-neon.xml | 2 +-
>> plugins/meson.build | 19 ++
>> scripts/feature_to_c.py | 46 ++++-
>> tests/avocado/tcg_plugins.py | 28 +--
>> tests/plugin/meson.build | 14 +-
>> tests/tcg/multiarch/Makefile.target | 11 +-
>> tests/tcg/multiarch/gdbstub/registers.py | 197 +++++++++++++++++++++
>> tests/tcg/multiarch/system/Makefile.softmmu-target | 13 +-
>> tests/tcg/nios2/Makefile.target | 11 ++
>> tests/tcg/ppc64/Makefile.target | 7 +
>> tests/tcg/s390x/Makefile.target | 4 +
>> 27 files changed, 637 insertions(+), 58 deletions(-)
>> create mode 100644 contrib/plugins/win32_linker.c
>> create mode 100644 tests/tcg/multiarch/gdbstub/registers.py
>> create mode 100644 tests/tcg/nios2/Makefile.target
>>
>> --
>> 2.39.2
>>
>>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2
2023-11-08 12:36 ` [PULL 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2 Stefan Hajnoczi
2023-11-08 14:56 ` Alex Bennée
@ 2023-11-08 15:54 ` Alex Bennée
1 sibling, 0 replies; 31+ messages in thread
From: Alex Bennée @ 2023-11-08 15:54 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel
Stefan Hajnoczi <stefanha@gmail.com> writes:
> On Tue, 7 Nov 2023 at 22:25, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> The following changes since commit 462ad017ed76889d46696a3581e1b52343f9b683:
>>
>> Merge tag 'pixman-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2023-11-07 19:00:03 +0800)
>>
>> are available in the Git repository at:
>>
>> https://gitlab.com/stsquad/qemu.git tags/pull-halloween-omnibus-071123-1
>>
>> for you to fetch changes up to 00da668de6856d912cd75474ba759927e29d0e49:
>>
>> Revert "tests/tcg/nios2: Re-enable linux-user tests" (2023-11-07 14:18:29 +0000)
>>
>> ----------------------------------------------------------------
>> Final test, gdbstub, plugin and gitdm updates for 8.2
>>
>> - fix duplicate register in arm xml
>> - hide various duplicate system registers from gdbstub
>> - add new gdb register test to the CI (skipping s390x/ppc64 for now)
>> - introduce GDBFeatureBuilder
>> - move plugin initialisation to after vCPU init completes
>> - enable building TCG plugins on Windows platform
>
> Hi Alex,
> Please take a look at the following CI failure:
>
> i686-w64-mingw32-gcc -m32 -o tests/plugin/libempty.dll
> plugins/qemu_plugin_api.lib tests/plugin/libempty.dll.p/empty.c.obj
> tests/plugin/libempty.dll.p/.._.._contrib_plugins_win32_linker.c.obj
> -Wl,--allow-shlib-undefined -shared -Wl,--start-group
> -Wl,--out-implib=tests/plugin/libempty.dll.a -fstack-protector-strong
> -Wl,--no-seh -Wl,--nxcompat -Wl,--dynamicbase -Wl,--warn-common
> /usr/i686-w64-mingw32/sys-root/mingw/lib/libglib-2.0.dll.a
> /usr/i686-w64-mingw32/sys-root/mingw/lib/libintl.dll.a
> /usr/i686-w64-mingw32/sys-root/mingw/lib/libgmodule-2.0.dll.a
> -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32
> -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
> /usr/lib/gcc/i686-w64-mingw32/12.2.1/../../../../i686-w64-mingw32/bin/ld:
> tests/plugin/libempty.dll.p/empty.c.obj: in function
> `qemu_plugin_install':
> /builds/qemu-project/qemu/build/../tests/plugin/empty.c:30: undefined
> reference to `_imp__qemu_plugin_register_vcpu_tb_trans_cb'
> collect2: error: ld returned 1 exit status
>
> https://gitlab.com/qemu-project/qemu/-/jobs/5487689202
Please see:
Message-Id: <20231108151743.3834165-1-alex.bennee@linaro.org>
Date: Wed, 8 Nov 2023 15:17:43 +0000
Subject: [PULL v2 00/23] Final test, gdbstub, plugin and gitdm updates for 8.2
From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>
CI currently running:
https://gitlab.com/stsquad/qemu/-/pipelines/1065418931
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 31+ messages in thread