* [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour
@ 2019-07-05 13:29 Alex Bennée
2019-07-05 14:20 ` Philippe Mathieu-Daudé
2019-07-05 17:05 ` Mark Cave-Ayland
0 siblings, 2 replies; 3+ messages in thread
From: Alex Bennée @ 2019-07-05 13:29 UTC (permalink / raw)
To: qemu-devel
Cc: Mark Cave-Ayland, Alex Bennée, Jon Doron,
Philippe Mathieu-Daudé
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
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Jon Doron <arilou@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
gdbstub.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index ea3349d1aa..b6df7ee25a 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -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;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour
2019-07-05 13:29 [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour Alex Bennée
@ 2019-07-05 14:20 ` Philippe Mathieu-Daudé
2019-07-05 17:05 ` Mark Cave-Ayland
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-05 14:20 UTC (permalink / raw)
To: Alex Bennée, qemu-devel; +Cc: Mark Cave-Ayland, Jon Doron
On 7/5/19 3:29 PM, Alex Bennée wrote:
> 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
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Jon Doron <arilou@gmail.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> gdbstub.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index ea3349d1aa..b6df7ee25a 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -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;
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour
2019-07-05 13:29 [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour Alex Bennée
2019-07-05 14:20 ` Philippe Mathieu-Daudé
@ 2019-07-05 17:05 ` Mark Cave-Ayland
1 sibling, 0 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2019-07-05 17:05 UTC (permalink / raw)
To: Alex Bennée, qemu-devel; +Cc: Philippe Mathieu-Daudé, Jon Doron
On 05/07/2019 14:29, Alex Bennée wrote:
> 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
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Jon Doron <arilou@gmail.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> gdbstub.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index ea3349d1aa..b6df7ee25a 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -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;
>
Works for me - thanks for the quick response!
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
ATB,
Mark.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-05 17:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-05 13:29 [Qemu-devel] [PATCH for 4.1] gdbstub: revert to previous set_reg behaviour Alex Bennée
2019-07-05 14:20 ` Philippe Mathieu-Daudé
2019-07-05 17:05 ` Mark Cave-Ayland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).