gdbstub: revert to previous set_reg behaviour
PATCH 1/1 gdbstub: revert to previous set_reg behaviour
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.
--- gdbstub.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
gdbstub.c +12 -6
@@ -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
Quoted 48 lines · Alex Bennée
The refactoring of
handle_set_regmissed 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 62b3320bdddSigned-off-by Alex Bennée <[email protected]>Cc Jon Doron <[email protected]>Cc Mark Cave-Ayland <[email protected]>--- gdbstub.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)gdbstub.c +12
-1@@ -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) {
gdbstub.c static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) · line 1710
Quoted 10 lines
gdbstub.c +0
-5int 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 ;
Quoted 48 lines · Alex Bennée
The refactoring of
handle_set_regmissed 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 62b3320bdddSigned-off-by Alex Bennée <[email protected]>Cc Jon Doron <[email protected]>Cc Mark Cave-Ayland <[email protected]>--- gdbstub.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)gdbstub.c +12
-1@@ -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) {
gdbstub.c static void handle_get_reg(GdbCmdContext *gdb_ctx, void *user_ctx) · line 1710
Quoted 10 lines
gdbstub.c +0
-5int 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!
ATB,
Mark.