From 488df7e6f73c8cf53483a4e856c4aad51fda6330 Mon Sep 17 00:00:00 2001 From: Fabrice Prost-Boucle Date: Wed, 19 Jan 2022 22:25:11 +0100 Subject: [PATCH] sscanf cleanup in GDB Z packet handling function. Tested working with arm-none-eabi-gcc 10.2.1 --- src/gdb_main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gdb_main.c b/src/gdb_main.c index bdff229a..bfbe8cd6 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -539,11 +539,7 @@ handle_z_packet(char *packet, int plen) uint32_t addr; int ret; - /* I have no idea why this doesn't work. Seems to work - * with real sscanf() though... */ - //sscanf(packet, "%*[zZ]%hhd,%08lX,%hhd", &type, &addr, &len); - type = packet[1] - '0'; - sscanf(packet + 2, ",%" PRIx32 ",%d", &addr, &len); + sscanf(packet, "%*[zZ]%d,%08" PRIX32 ",%d", &type, &addr, &len); if(set) ret = target_breakwatch_set(cur_target, type, addr, len); else