Skip to contentSkip to conversation

tcg tests and gdbstub fixes

PATCH In review Alex Bennée 4 participants 18 messages Jul 5, 2019 – Jul 10, 2019

lore
Share & tools
lore
#0 lore raw

cover tcg tests and gdbstub fixes

Hi,

A small selection of clean-up patches covering failing tests and gdbstub.

The following patches need review
patch 0002/tests tcg fix up test i386 fprem.ref generation.patch patch 0003/tests tcg fix diff out pass to properly report fa.patch patch 0004/gdbstub add some notes to the header comment.patch

Alex Bennée (4):
tests/tcg: fix up test-i386-fprem.ref generation tests/tcg: fix diff-out pass to properly report failure
gdbstub: add some notes to the header comment
gdbstub: revert to previous set_reg behaviour

Philippe Mathieu-Daudé (1):
target/arm/vfp_helper: Call set_fpscr_to_host before updating FPSCR
reg

 gdbstub.c                      | 24 ++++++++++++++++++------
 target/arm/vfp_helper.c        |  4 ++--
 tests/tcg/Makefile             |  6 +++++-
 tests/tcg/i386/Makefile.target |  4 ++--
 4 files changed, 27 insertions(+), 11 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/5 target/arm/vfp_helper: Call set_fpscr_to_host before updating FPSCR reg

From: Philippe Mathieu-Daudé <[email protected]>

In commit e9d652824b0 we extracted the vfp_set_fpscr_to_host() function but failed at calling it in the correct place, we call it after xregs[ARM_VFP_FPSCR] is modified.

Fix by calling this function before we update FPSCR.

Message-Id: <[email protected]>

---
 target/arm/vfp_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/vfp_helper.c +2 -2
index 46041e3294..9710ef1c3e 100644
@@ -197,6 +197,8 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
         val &= 0xf7c0009f;
     }
 
+    vfp_set_fpscr_to_host(env, val);
+
     /*
      * We don't implement trapped exception handling, so the
      * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!)
@@ -217,8 +219,6 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
     env->vfp.qc[1] = 0;
     env->vfp.qc[2] = 0;
     env->vfp.qc[3] = 0;
-
-    vfp_set_fpscr_to_host(env, val);
 }
 
 void vfp_set_fpscr(CPUARMState *env, uint32_t val)
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/5 tests/tcg: fix up test-i386-fprem.ref generation

In reply to Alex Bennée

We never shipped the reference data in the source tree because it was quite big (64M). As a result the only option is to generate it locally. Although we have a rule to generate the reference file we missed the dependency and location changes, probably because it is only run for SLOW test runs.

The test still fails with mostly incorrect flags and different than expected NaNs. I'll leave that for the x86 experts to look at.

Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
Cc Jan Bobek <[email protected]>
---
 tests/tcg/i386/Makefile.target | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/tcg/i386/Makefile.target +2 -2
index b4033ba3d1..d0eb7023e5 100644
@@ -35,9 +35,9 @@ test-i386-fprem.ref: test-i386-fprem
 	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
 
 run-test-i386-fprem: TIMEOUT=60
-run-test-i386-fprem: test-i386-fprem
+run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref
 	$(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)")
-	$(call diff-out,test-i386-fprem, $(I386_SRC)/$<.ref)
+	$(call diff-out,test-i386-fprem, test-i386-fprem.ref)
 else
 run-test-i386-fprem: test-i386-fprem
 	$(call skip-test, $<, "SLOW")
Signature · 1 line
2.20.1
Reviewed-by on v1 2/5
#3 lore raw

Re: [Qemu-devel] [PATCH v1 2/5] tests/tcg: fix up test-i386-fprem.ref generation

Quoted 9 lines · Alex Bennée

We never shipped the reference data in the source tree because it was quite big (64M). As a result the only option is to generate it locally. Although we have a rule to generate the reference file we missed the dependency and location changes, probably because it is only run for SLOW test runs.

The test still fails with mostly incorrect flags and different than expected NaNs. I'll leave that for the x86 experts to look at.

Quoted 8 lines
Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
Cc Jan Bobek <[email protected]>
---
 tests/tcg/i386/Makefile.target | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

There's nothing here to guess that test-i386-fprem is in any way natively runnable. Otherwise you might just end up testing against the installed qemu.

On the other hand, at the moment this simply won't run at all, since the input file is missing. So I suppose this is good enough for SLOW.

r~

#4 lore raw

Re: [Qemu-devel] [PATCH v1 2/5] tests/tcg: fix up test-i386-fprem.ref generation

In reply to Alex Bennée
Quoted 2 lines · Alex Bennée

We never shipped the reference data in the source tree because it was quite big (64M). As a result the only option is to generate it

Can we fetch it (with hash verification) or store it compressed?

$ du -ch pc-bios/edk2-*bz2
1.2M    pc-bios/edk2-aarch64-code.fd.bz2
1.2M    pc-bios/edk2-arm-code.fd.bz2
4.0K    pc-bios/edk2-arm-vars.fd.bz2
1.7M    pc-bios/edk2-i386-code.fd.bz2
1.9M    pc-bios/edk2-i386-secure-code.fd.bz2
4.0K    pc-bios/edk2-i386-vars.fd.bz2
1.7M    pc-bios/edk2-x86_64-code.fd.bz2
1.9M    pc-bios/edk2-x86_64-secure-code.fd.bz2
9.3M    total
Quoted 33 lines

locally. Although we have a rule to generate the reference file we missed the dependency and location changes, probably because it is only run for SLOW test runs.

The test still fails with mostly incorrect flags and different than expected NaNs. I'll leave that for the x86 experts to look at.

Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
Cc Jan Bobek <[email protected]>
---
 tests/tcg/i386/Makefile.target | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/tcg/i386/Makefile.target +2 -2
index b4033ba3d1..d0eb7023e5 100644
@@ -35,9 +35,9 @@ test-i386-fprem.ref: test-i386-fprem
 	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
 
 run-test-i386-fprem: TIMEOUT=60
-run-test-i386-fprem: test-i386-fprem
+run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref
 	$(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)")
-	$(call diff-out,test-i386-fprem, $(I386_SRC)/$<.ref)
+	$(call diff-out,test-i386-fprem, test-i386-fprem.ref)
 else
 run-test-i386-fprem: test-i386-fprem
 	$(call skip-test, $<, "SLOW")
#5 lore raw

Re: [Qemu-devel] [PATCH v1 2/5] tests/tcg: fix up test-i386-fprem.ref generation

Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Alex Bennée

We never shipped the reference data in the source tree because it was quite big (64M). As a result the only option is to generate it

Can we fetch it (with hash verification) or store it compressed?

Seems like a lot of hoops to jump through. The limitation is that you need to be on an x86 to generate the reference data but that isn't very hard these days. If you do happen to be on non-x86 and are not paying attention it becomes a simple regression test against the system (binfmt_misc) run QEMU. But as it is currently broken and needing some love it's just an incremental improvement for where we are at the moment.

Quoted 35 lines
$ du -ch pc-bios/edk2-*bz2
1.2M    pc-bios/edk2-aarch64-code.fd.bz2
1.2M    pc-bios/edk2-arm-code.fd.bz2
4.0K    pc-bios/edk2-arm-vars.fd.bz2
1.7M    pc-bios/edk2-i386-code.fd.bz2
1.9M    pc-bios/edk2-i386-secure-code.fd.bz2
4.0K    pc-bios/edk2-i386-vars.fd.bz2
1.7M    pc-bios/edk2-x86_64-code.fd.bz2
1.9M    pc-bios/edk2-x86_64-secure-code.fd.bz2
9.3M    total
Quoted 23 lines

locally. Although we have a rule to generate the reference file we missed the dependency and location changes, probably because it is only run for SLOW test runs.

The test still fails with mostly incorrect flags and different than expected NaNs. I'll leave that for the x86 experts to look at.

Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
Cc Jan Bobek <[email protected]>
---
 tests/tcg/i386/Makefile.target | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/tcg/i386/Makefile.target +0 -0
index b4033ba3d1..d0eb7023e5 100644
@@ -35,9 +35,9 @@ test-i386-fprem.ref: test-i386-fprem
 	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
 
Quoted 10 lines

tests/tcg/i386/Makefile.target test-i386-fprem.ref: test-i386-fprem · line 43

Quoted 10 lines
tests/tcg/i386/Makefile.target +2 -2
 run-test-i386-fprem: TIMEOUT=60
-run-test-i386-fprem: test-i386-fprem
+run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref
 	$(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)")
-	$(call diff-out,test-i386-fprem, $(I386_SRC)/$<.ref)
+	$(call diff-out,test-i386-fprem, test-i386-fprem.ref)
 else
 run-test-i386-fprem: test-i386-fprem
 	$(call skip-test, $<, "SLOW")

--
Alex Bennée

#6 lore raw

PATCH 3/5 tests/tcg: fix diff-out pass to properly report failure

In reply to Alex Bennée

A side effect of piping the output to head is squash the exit status of the diff command. Fix this by only doing the pipe if the diff failed and then ensuring the status is non-zero.

---
 tests/tcg/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tests/tcg/Makefile +5 -1
index 6fa63cc8d5..7973cd1ba2 100644
@@ -45,7 +45,11 @@ run-test = $(call quiet-command, timeout $(TIMEOUT) $2,"TEST",$3)
 endif
 
 # $1 = test name, $2 = reference
-diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2")
+# to work around the pipe squashing the status we only pipe the result if
+# we know it failed and then force failure at the end.
+diff-out = $(call quiet-command, diff -q $1.out $2 || \
+				 (diff -u $1.out $2 | head -n 10 && false), \
+				 "DIFF","$1.out with $2")
 
 # $1 = test name, $2 = reason
 skip-test = @printf "  SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2
Signature · 1 line
2.20.1
#7 lore raw

Re: [Qemu-devel] [PATCH v1 3/5] tests/tcg: fix diff-out pass to properly report failure

tests/tcg/Makefile run-test = $(call quiet-command, timeout $(TIMEOUT) $2,"TEST",$3) · line 51

Quoted 2 lines · Alex Bennée
tests/tcg/Makefile +2 -0
+diff-out = $(call quiet-command, diff -q $1.out $2 || \
+				 (diff -u $1.out $2 | head -n 10 && false), \

What about (set -o pipefail; diff ... | head) ?
I think we already rely on bash, right?

r~

#8 lore raw

Re: [Qemu-devel] [PATCH v1 3/5] tests/tcg: fix diff-out pass to properly report failure

Quoted 6 lines · Richard Henderson

tests/tcg/Makefile run-test = $(call quiet-command, timeout $(TIMEOUT) $2,"TEST",$3) · line 51

Quoted 2 lines · Alex Bennée
tests/tcg/Makefile +2 -0
+diff-out = $(call quiet-command, diff -q $1.out $2 || \
+				 (diff -u $1.out $2 | head -n 10 && false), \

What about (set -o pipefail; diff ... | head) ?
I think we already rely on bash, right?

I don't think so - we assume POSIX shell for configure and AFAICT we don't do anything special in the make system to set the shell type to bash.

--
Alex Bennée

#9 lore raw

PATCH 4/5 gdbstub: add some notes to the header comment

In reply to Alex Bennée

Add a link to the remote protocol spec and an SPDX tag.

---
 gdbstub.c | 6 ++++++
 1 file changed, 6 insertions(+)
gdbstub.c +6 -0
index 8618e34311..ea3349d1aa 100644
@@ -1,6 +1,10 @@
 /*
  * gdb server stub
  *
+ * This implements a subset of the remote protocol as described in:
+ *
+ *   https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -15,6 +19,8 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "qemu/osdep.h"
Signature · 1 line
2.20.1
Reviewed-by Tested-by on v1 4/5
#10 lore raw

Re: [PATCH v1 4/5] gdbstub: add some notes to the header comment

Quoted 24 lines · Alex Bennée

Add a link to the remote protocol spec and an SPDX tag.

---
 gdbstub.c | 6 ++++++
 1 file changed, 6 insertions(+)
gdbstub.c +4 -0
index 8618e34311..ea3349d1aa 100644
@@ -1,6 +1,10 @@
 /*
  * gdb server stub
  *
+ * This implements a subset of the remote protocol as described in:
+ *
+ *   https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or

gdbstub.c line 26

Quoted 8 lines
gdbstub.c +2 -0
@@ -15,6 +19,8 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "qemu/osdep.h"
#11 lore raw

Re: [Qemu-devel] [PATCH v1 4/5] gdbstub: add some notes to the header comment

In reply to Alex Bennée
Quoted 12 lines · Alex Bennée

Add a link to the remote protocol spec and an SPDX tag.

---
 gdbstub.c | 6 ++++++
 1 file changed, 6 insertions(+)
gdbstub.c +0 -0
index 8618e34311..ea3349d1aa 100644

gdbstub.c line 7

Quoted 7 lines
gdbstub.c +4 -0
@@ -1,6 +1,10 @@
 /*
  * gdb server stub
  *
+ * This implements a subset of the remote protocol as described in:
+ *
+ *   https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
+ *

Ack.

gdbstub.c line 23

Quoted 9 lines
gdbstub.c +2 -0
  * Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -15,6 +19,8 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later

Nack. The text is for the LGPL.

r~

#12 lore raw

Re: [Qemu-devel] [PATCH v1 4/5] gdbstub: add some notes to the header comment

Quoted 23 lines · Richard Henderson
Quoted 12 lines · Alex Bennée

Add a link to the remote protocol spec and an SPDX tag.

---
 gdbstub.c | 6 ++++++
 1 file changed, 6 insertions(+)
gdbstub.c +0 -0
index 8618e34311..ea3349d1aa 100644

gdbstub.c line 7

Quoted 7 lines
gdbstub.c +4 -0
@@ -1,6 +1,10 @@
 /*
  * gdb server stub
  *
+ * This implements a subset of the remote protocol as described in:
+ *
+ *   https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
+ *

Ack.

Quoted 11 lines

gdbstub.c line 23

Quoted 9 lines
gdbstub.c +2 -0
  * Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -15,6 +19,8 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later

Nack. The text is for the LGPL.

Fixed in my PR.

--
Alex Bennée

#13 lore raw

PATCH 5/5 gdbstub: revert to previous set_reg behaviour

In reply to Alex Bennée

The refactoring of handle_set_reg missed the fact we previously had responded with an empty packet when we were not using XML based protocols. This broke the fallback behaviour for architectures that don't have registers defined in QEMU's gdb-xml directory.

Revert to the previous behaviour and clean up the commentary for what is going on.

Fixes 62b3320bddd
Cc Jon Doron <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
---
 gdbstub.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
gdbstub.c +12 -6
index ea3349d1aa..b6df7ee25a 100644
@@ -1669,12 +1669,23 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx)
     put_packet(gdb_ctx->s, "E22");
 }
 
+/*
+ * handle_set/get_reg
+ *
+ * Older gdb are really dumb, and don't use 'G/g' if 'P/p' is available.
+ * This works, but can be very slow. Anything new enough to understand
+ * XML also knows how to use this properly. However to use this we
+ * need to define a local XML file as well as be talking to a
+ * reasonably modern gdb. Responding with an empty packet will cause
+ * the remote gdb to fallback to older methods.
+ */
+
 static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx)
 {
     int reg_size;
 
     if (!gdb_has_xml) {
-        put_packet(gdb_ctx->s, "E00");
+        put_packet(gdb_ctx->s, "");
         return;
     }
 
@@ -1694,11 +1705,6 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx)
 {
     int reg_size;
 
-    /*
-     * Older gdb are really dumb, and don't use 'g' if 'p' is avaialable.
-     * This works, but can be very slow.  Anything new enough to
-     * understand XML also knows how to use this properly.
-     */
     if (!gdb_has_xml) {
         put_packet(gdb_ctx->s, "");
         return;
Signature · 1 line
2.20.1
Reviewed-by on v1 5/5
#14 lore raw

Re: [Qemu-devel] [PATCH v1 5/5] gdbstub: revert to previous set_reg behaviour

Quoted 8 lines · Alex Bennée

The refactoring of handle_set_reg missed the fact we previously had responded with an empty packet when we were not using XML based protocols. This broke the fallback behaviour for architectures that don't have registers defined in QEMU's gdb-xml directory.

Revert to the previous behaviour and clean up the commentary for what is going on.

Quoted 8 lines
Fixes 62b3320bddd
Cc Jon Doron <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
---
 gdbstub.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

r~

#15 lore raw

Re: [Qemu-devel] [PATCH v1 5/5] gdbstub: revert to previous set_reg behaviour

In reply to Alex Bennée
Quoted 9 lines · Alex Bennée

The refactoring of handle_set_reg missed the fact we previously had responded with an empty packet when we were not using XML based protocols. This broke the fallback behaviour for architectures that don't have registers defined in QEMU's gdb-xml directory.

Revert to the previous behaviour and clean up the commentary for what is going on.

Quoted 6 lines
Fixes 62b3320bddd
Cc Jon Doron <[email protected]>
Cc Mark Cave-Ayland <[email protected]>

---

Do you plan to integrate this patch in 4.1?

Thanks, Aleksandar

gdbstub.c static void handle_remove_bp(GdbCmdContext

Quoted 8 lines
 gdbstub.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
gdbstub.c +0 -0
index ea3349d1aa..b6df7ee25a 100644
@@ -1669,12 +1669,23 @@ static void handle_remove_bp(GdbCmdContext

*gdb_ctx, void *user_ctx)

gdbstub.c static void handle_get_reg(GdbCmdContext *gdb_ctx,

Quoted 25 lines
gdbstub.c +12 -1
     put_packet(gdb_ctx->s, "E22");
 }
 
+/*
+ * handle_set/get_reg
+ *
+ * Older gdb are really dumb, and don't use 'G/g' if 'P/p' is available.
+ * This works, but can be very slow. Anything new enough to understand
+ * XML also knows how to use this properly. However to use this we
+ * need to define a local XML file as well as be talking to a
+ * reasonably modern gdb. Responding with an empty packet will cause
+ * the remote gdb to fallback to older methods.
+ */
+
 static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx)
 {
     int reg_size;
 
     if (!gdb_has_xml) {
-        put_packet(gdb_ctx->s, "E00");
+        put_packet(gdb_ctx->s, "");
         return;
     }
 
@@ -1694,11 +1705,6 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx,

void *user_ctx)

Quoted 15 lines
gdbstub.c +0 -6
 {
     int reg_size;
 
-    /*
-     * Older gdb are really dumb, and don't use 'g' if 'p' is avaialable.
-     * This works, but can be very slow.  Anything new enough to
-     * understand XML also knows how to use this properly.
-     */
     if (!gdb_has_xml) {
         put_packet(gdb_ctx->s, "");
         return;
--

2.20.1

#16 lore raw

Re: [Qemu-devel] [PATCH v1 5/5] gdbstub: revert to previous set_reg behaviour

Quoted 17 lines · Aleksandar Markovic
Quoted 9 lines · Alex Bennée

The refactoring of handle_set_reg missed the fact we previously had responded with an empty packet when we were not using XML based protocols. This broke the fallback behaviour for architectures that don't have registers defined in QEMU's gdb-xml directory.

Revert to the previous behaviour and clean up the commentary for what is going on.

Quoted 6 lines
Fixes 62b3320bddd
Cc Jon Doron <[email protected]>
Cc Mark Cave-Ayland <[email protected]>

---

Quoted 3 lines

Do you plan to integrate this patch in 4.1?

Thanks, Aleksandar

Yes - I'm putting together a PR today.

Quoted 28 lines

gdbstub.c static void handle_remove_bp(GdbCmdContext

Quoted 9 lines
 gdbstub.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
gdbstub.c +0 -0
index ea3349d1aa..b6df7ee25a 100644
@@ -1669,12 +1669,23 @@ static void handle_remove_bp(GdbCmdContext

*gdb_ctx, void *user_ctx)

Quoted 18 lines
gdbstub.c +11 -0
     put_packet(gdb_ctx->s, "E22");
 }
 
+/*
+ * handle_set/get_reg
+ *
+ * Older gdb are really dumb, and don't use 'G/g' if 'P/p' is available.
+ * This works, but can be very slow. Anything new enough to understand
+ * XML also knows how to use this properly. However to use this we
+ * need to define a local XML file as well as be talking to a
+ * reasonably modern gdb. Responding with an empty packet will cause
+ * the remote gdb to fallback to older methods.
+ */
+
 static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx)
 {
     int reg_size;
 
Quoted 23 lines

gdbstub.c static void handle_get_reg(GdbCmdContext *gdb_ctx,

Quoted 7 lines
gdbstub.c +1 -1
     if (!gdb_has_xml) {
-        put_packet(gdb_ctx->s, "E00");
+        put_packet(gdb_ctx->s, "");
         return;
     }
 
@@ -1694,11 +1705,6 @@ static void handle_get_reg(GdbCmdContext *gdb_ctx,

void *user_ctx)

Quoted 15 lines
gdbstub.c +0 -6
 {
     int reg_size;
 
-    /*
-     * Older gdb are really dumb, and don't use 'g' if 'p' is avaialable.
-     * This works, but can be very slow.  Anything new enough to
-     * understand XML also knows how to use this properly.
-     */
     if (!gdb_has_xml) {
         put_packet(gdb_ctx->s, "");
         return;
--

2.20.1

--
Alex Bennée

#17 lore raw

Re: [Qemu-devel] [PATCH v1 5/5] gdbstub: revert to previous set_reg behaviour

Quoted 21 lines · Alex Bennée
Quoted 17 lines · Aleksandar Markovic
Quoted 15 lines · Alex Bennée

The refactoring of handle_set_reg missed the fact we previously had responded with an empty packet when we were not using XML based protocols. This broke the fallback behaviour for architectures that don't have registers defined in QEMU's gdb-xml directory.

Revert to the previous behaviour and clean up the commentary for what is going on.

Fixes 62b3320bddd
Cc Jon Doron <[email protected]>
Cc Mark Cave-Ayland <[email protected]>

---

Quoted 6 lines
Quoted 3 lines

Do you plan to integrate this patch in 4.1?

Thanks, Aleksandar

Yes - I'm putting together a PR today.

That's great, thanks!!

Aleksandar

Quoted 10 lines
Quoted 10 lines

gdbstub.c static void handle_remove_bp(GdbCmdContext

Quoted 9 lines
 gdbstub.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
gdbstub.c +0 -0
index ea3349d1aa..b6df7ee25a 100644
@@ -1669,12 +1669,23 @@ static void handle_remove_bp(GdbCmdContext

*gdb_ctx, void *user_ctx)

Quoted 7 lines
Quoted 7 lines

gdbstub.c static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx)

Quoted 7 lines
gdbstub.c +4 -0
     put_packet(gdb_ctx->s, "E22");
 }
 
+/*
+ * handle_set/get_reg
+ *
+ * Older gdb are really dumb, and don't use 'G/g' if 'P/p' is

available.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
gdbstub.c +7 -0
+ * This works, but can be very slow. Anything new enough to understand
+ * XML also knows how to use this properly. However to use this we
+ * need to define a local XML file as well as be talking to a
+ * reasonably modern gdb. Responding with an empty packet will cause
+ * the remote gdb to fallback to older methods.
+ */
+
 static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx)
 {
     int reg_size;
 
Quoted 7 lines
Quoted 7 lines

gdbstub.c static void handle_get_reg(GdbCmdContext

Quoted 7 lines
gdbstub.c +1 -1
     if (!gdb_has_xml) {
-        put_packet(gdb_ctx->s, "E00");
+        put_packet(gdb_ctx->s, "");
         return;
     }
 
@@ -1694,11 +1705,6 @@ static void handle_get_reg(GdbCmdContext

*gdb_ctx,

Quoted 6 lines
Quoted 6 lines

void *user_ctx)

Quoted 5 lines
gdbstub.c +0 -2
 {
     int reg_size;
 
-    /*
-     * Older gdb are really dumb, and don't use 'g' if 'p' is

avaialable.

Quoted 14 lines
Quoted 10 lines
Quoted 10 lines
gdbstub.c +0 -4
-     * This works, but can be very slow.  Anything new enough to
-     * understand XML also knows how to use this properly.
-     */
     if (!gdb_has_xml) {
         put_packet(gdb_ctx->s, "");
         return;
--

2.20.1

--
Alex Bennée