Skip to content

Commit

Permalink
gdbstub: revert to previous set_reg behaviour
Browse files Browse the repository at this point in the history
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: 62b3320
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Jon Doron <arilou@gmail.com>
  • Loading branch information
stsquad committed Jul 10, 2019
1 parent 42a0959 commit 94b2a62
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1673,12 +1673,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;
}

Expand All @@ -1698,11 +1709,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;
Expand Down

0 comments on commit 94b2a62

Please sign in to comment.