server/gdb-server: fix type error.

Fix flash operation error when addr-width > 32bit
on any 32-bit OS and some 64-bit OS (windows).

Change-Id: I199f1cc5128c45bd0bb155e37acb2fb6325dff88
Signed-off-by: wangyanwen <wangyanwen@nucleisys.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8095
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
wangyanwen 2023-10-09 14:08:59 +08:00 committed by Tomas Vanek
parent 7145b984a9
commit 9d5117a23e
1 changed files with 5 additions and 4 deletions

View File

@ -3286,7 +3286,7 @@ static int gdb_v_packet(struct connection *connection,
}
if (strncmp(packet, "vFlashErase:", 12) == 0) {
unsigned long addr;
target_addr_t addr;
unsigned long length;
char const *parse = packet + 12;
@ -3295,7 +3295,7 @@ static int gdb_v_packet(struct connection *connection,
return ERROR_SERVER_REMOTE_CLOSED;
}
addr = strtoul(parse, (char **)&parse, 16);
addr = strtoull(parse, (char **)&parse, 16);
if (*(parse++) != ',' || *parse == '\0') {
LOG_ERROR("incomplete vFlashErase packet received, dropping connection");
@ -3343,7 +3343,7 @@ static int gdb_v_packet(struct connection *connection,
if (strncmp(packet, "vFlashWrite:", 12) == 0) {
int retval;
unsigned long addr;
target_addr_t addr;
unsigned long length;
char const *parse = packet + 12;
@ -3351,7 +3351,8 @@ static int gdb_v_packet(struct connection *connection,
LOG_ERROR("incomplete vFlashErase packet received, dropping connection");
return ERROR_SERVER_REMOTE_CLOSED;
}
addr = strtoul(parse, (char **)&parse, 16);
addr = strtoull(parse, (char **)&parse, 16);
if (*(parse++) != ':') {
LOG_ERROR("incomplete vFlashErase packet received, dropping connection");
return ERROR_SERVER_REMOTE_CLOSED;