target/semihosting: drop type casting from semihosting->result
Also used type helper (PRId64) to specify format of int64_t Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I594863eab594aff621c26fefcc69a1872e9730ee Reviewed-on: https://review.openocd.org/c/openocd/+/7111 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
9cd714cd14
commit
c271958850
|
@ -406,7 +406,7 @@ int semihosting_common(struct target *target)
|
||||||
} else {
|
} else {
|
||||||
semihosting->result = close(fd);
|
semihosting->result = close(fd);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("close(%d)=%d", fd, (int)semihosting->result);
|
LOG_DEBUG("close(%d)=%" PRId64, fd, semihosting->result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -631,10 +631,10 @@ int semihosting_common(struct target *target)
|
||||||
semihosting->result = fstat(fd, &buf);
|
semihosting->result = fstat(fd, &buf);
|
||||||
if (semihosting->result == -1) {
|
if (semihosting->result == -1) {
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("fstat(%d)=%d", fd, (int)semihosting->result);
|
LOG_DEBUG("fstat(%d)=%" PRId64, fd, semihosting->result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("fstat(%d)=%d", fd, (int)semihosting->result);
|
LOG_DEBUG("fstat(%d)=%" PRId64, fd, semihosting->result);
|
||||||
semihosting->result = buf.st_size;
|
semihosting->result = buf.st_size;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -691,8 +691,7 @@ int semihosting_common(struct target *target)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("SYS_GET_CMDLINE=[%s],%d", arg,
|
LOG_DEBUG("SYS_GET_CMDLINE=[%s], %" PRId64, arg, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -784,7 +783,7 @@ int semihosting_common(struct target *target)
|
||||||
int fd = semihosting_get_field(target, 0, fields);
|
int fd = semihosting_get_field(target, 0, fields);
|
||||||
semihosting->result = isatty(fd);
|
semihosting->result = isatty(fd);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("isatty(%d)=%d", fd, (int)semihosting->result);
|
LOG_DEBUG("isatty(%d)=%" PRId64, fd, semihosting->result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -902,22 +901,19 @@ int semihosting_common(struct target *target)
|
||||||
semihosting->result = fd;
|
semihosting->result = fd;
|
||||||
semihosting->stdin_fd = fd;
|
semihosting->stdin_fd = fd;
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("dup(STDIN)=%d",
|
LOG_DEBUG("dup(STDIN)=%" PRId64, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
} else if (mode < 8) {
|
} else if (mode < 8) {
|
||||||
int fd = dup(STDOUT_FILENO);
|
int fd = dup(STDOUT_FILENO);
|
||||||
semihosting->result = fd;
|
semihosting->result = fd;
|
||||||
semihosting->stdout_fd = fd;
|
semihosting->stdout_fd = fd;
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("dup(STDOUT)=%d",
|
LOG_DEBUG("dup(STDOUT)=%" PRId64, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
} else {
|
} else {
|
||||||
int fd = dup(STDERR_FILENO);
|
int fd = dup(STDERR_FILENO);
|
||||||
semihosting->result = fd;
|
semihosting->result = fd;
|
||||||
semihosting->stderr_fd = fd;
|
semihosting->stderr_fd = fd;
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("dup(STDERR)=%d",
|
LOG_DEBUG("dup(STDERR)=%" PRId64, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* cygwin requires the permission setting
|
/* cygwin requires the permission setting
|
||||||
|
@ -927,8 +923,7 @@ int semihosting_common(struct target *target)
|
||||||
open_host_modeflags[mode],
|
open_host_modeflags[mode],
|
||||||
0644);
|
0644);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("open('%s')=%d", fn,
|
LOG_DEBUG("open('%s')=%" PRId64, fn, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(fn);
|
free(fn);
|
||||||
|
@ -991,11 +986,11 @@ int semihosting_common(struct target *target)
|
||||||
semihosting->sys_errno = ENOMEM;
|
semihosting->sys_errno = ENOMEM;
|
||||||
} else {
|
} else {
|
||||||
semihosting->result = semihosting_read(semihosting, fd, buf, len);
|
semihosting->result = semihosting_read(semihosting, fd, buf, len);
|
||||||
LOG_DEBUG("read(%d, 0x%" PRIx64 ", %zu)=%d",
|
LOG_DEBUG("read(%d, 0x%" PRIx64 ", %zu)=%" PRId64,
|
||||||
fd,
|
fd,
|
||||||
addr,
|
addr,
|
||||||
len,
|
len,
|
||||||
(int)semihosting->result);
|
semihosting->result);
|
||||||
if (semihosting->result >= 0) {
|
if (semihosting->result >= 0) {
|
||||||
retval = target_write_buffer(target, addr,
|
retval = target_write_buffer(target, addr,
|
||||||
semihosting->result,
|
semihosting->result,
|
||||||
|
@ -1031,7 +1026,7 @@ int semihosting_common(struct target *target)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
semihosting->result = semihosting_getchar(semihosting, semihosting->stdin_fd);
|
semihosting->result = semihosting_getchar(semihosting, semihosting->stdin_fd);
|
||||||
LOG_DEBUG("getchar()=%d", (int)semihosting->result);
|
LOG_DEBUG("getchar()=%" PRId64, semihosting->result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEMIHOSTING_SYS_REMOVE: /* 0x0E */
|
case SEMIHOSTING_SYS_REMOVE: /* 0x0E */
|
||||||
|
@ -1077,8 +1072,7 @@ int semihosting_common(struct target *target)
|
||||||
fn[len] = 0;
|
fn[len] = 0;
|
||||||
semihosting->result = remove((char *)fn);
|
semihosting->result = remove((char *)fn);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("remove('%s')=%d", fn,
|
LOG_DEBUG("remove('%s')=%" PRId64, fn, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
|
|
||||||
free(fn);
|
free(fn);
|
||||||
}
|
}
|
||||||
|
@ -1147,9 +1141,7 @@ int semihosting_common(struct target *target)
|
||||||
semihosting->result = rename((char *)fn1,
|
semihosting->result = rename((char *)fn1,
|
||||||
(char *)fn2);
|
(char *)fn2);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("rename('%s', '%s')=%d", fn1, fn2,
|
LOG_DEBUG("rename('%s', '%s')=%" PRId64 " %d", fn1, fn2, semihosting->result, errno);
|
||||||
(int)semihosting->result);
|
|
||||||
|
|
||||||
free(fn1);
|
free(fn1);
|
||||||
free(fn2);
|
free(fn2);
|
||||||
}
|
}
|
||||||
|
@ -1194,8 +1186,7 @@ int semihosting_common(struct target *target)
|
||||||
} else {
|
} else {
|
||||||
semihosting->result = lseek(fd, pos, SEEK_SET);
|
semihosting->result = lseek(fd, pos, SEEK_SET);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("lseek(%d, %d)=%d", fd, (int)pos,
|
LOG_DEBUG("lseek(%d, %d)=%" PRId64, fd, (int)pos, semihosting->result);
|
||||||
(int)semihosting->result);
|
|
||||||
if (semihosting->result == pos)
|
if (semihosting->result == pos)
|
||||||
semihosting->result = 0;
|
semihosting->result = 0;
|
||||||
}
|
}
|
||||||
|
@ -1254,9 +1245,7 @@ int semihosting_common(struct target *target)
|
||||||
cmd[len] = 0;
|
cmd[len] = 0;
|
||||||
semihosting->result = system(
|
semihosting->result = system(
|
||||||
(const char *)cmd);
|
(const char *)cmd);
|
||||||
LOG_DEBUG("system('%s')=%d",
|
LOG_DEBUG("system('%s')=%" PRId64, cmd, semihosting->result);
|
||||||
cmd,
|
|
||||||
(int)semihosting->result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
@ -1335,11 +1324,11 @@ int semihosting_common(struct target *target)
|
||||||
}
|
}
|
||||||
semihosting->result = semihosting_write(semihosting, fd, buf, len);
|
semihosting->result = semihosting_write(semihosting, fd, buf, len);
|
||||||
semihosting->sys_errno = errno;
|
semihosting->sys_errno = errno;
|
||||||
LOG_DEBUG("write(%d, 0x%" PRIx64 ", %zu)=%d",
|
LOG_DEBUG("write(%d, 0x%" PRIx64 ", %zu)=%" PRId64,
|
||||||
fd,
|
fd,
|
||||||
addr,
|
addr,
|
||||||
len,
|
len,
|
||||||
(int)semihosting->result);
|
semihosting->result);
|
||||||
if (semihosting->result >= 0) {
|
if (semihosting->result >= 0) {
|
||||||
/* The number of bytes that are NOT written.
|
/* The number of bytes that are NOT written.
|
||||||
* */
|
* */
|
||||||
|
|
Loading…
Reference in New Issue