|
From: openocd-gerrit <ope...@us...> - 2023-06-10 17:10:45
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 9f23a1d7c1e27c556ef9787b9d3f263f5c1ecf24 (commit)
via 71180e67537117f841ff5dd7c359e3678d861e2b (commit)
from 0854c83076749196603bebdb47ec93f50a454f79 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9f23a1d7c1e27c556ef9787b9d3f263f5c1ecf24
Author: Marek Vrbka <mar...@co...>
Date: Tue May 30 14:16:38 2023 +0200
semihosting: fix non-zero value on Windows isatty()
On Windows, isatty() can return any non-zero value if it's an interactive
device. Which diverges from the ARM semihosting specification. This patch
introduces a fix to make the SYS_ISTTY operation conform to spec.
Change-Id: I9bc4f3cb82370812825d52419851910b3e3f35cc
Signed-off-by: Marek Vrbka <mar...@co...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7725
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan...@co...>
diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c
index 3ed112ba9..6c91876c7 100644
--- a/src/target/semihosting_common.c
+++ b/src/target/semihosting_common.c
@@ -779,7 +779,8 @@ int semihosting_common(struct target *target)
if (retval != ERROR_OK)
return retval;
int fd = semihosting_get_field(target, 0, fields);
- semihosting->result = isatty(fd);
+ // isatty() on Windows may return any non-zero value if fd is a terminal
+ semihosting->result = isatty(fd) ? 1 : 0;
semihosting->sys_errno = errno;
LOG_DEBUG("isatty(%d)=%" PRId64, fd, semihosting->result);
}
commit 71180e67537117f841ff5dd7c359e3678d861e2b
Author: Marek Vrbka <mar...@co...>
Date: Tue May 30 10:07:18 2023 +0200
gdb_server: refactor and unify function gdb_get_char_inner
The old implementation of gdb socket error handling
in the gdb_get_char_inner() differs between Windows and *nix
platforms. This patch simplifies it by using an existing
function log_socket_error() which handles most of the platform
specific things. It also provides better error messages.
Change-Id: Iec871c4965b116dc7cfb03c3565bab66c8b41958
Signed-off-by: Marek Vrbka <mar...@co...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7724
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 0baf7553b..702dbef49 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -235,39 +235,20 @@ static int gdb_get_char_inner(struct connection *connection, int *next_char)
}
#ifdef _WIN32
- errno = WSAGetLastError();
-
- switch (errno) {
- case WSAEWOULDBLOCK:
- usleep(1000);
- break;
- case WSAECONNABORTED:
- gdb_con->closed = true;
- return ERROR_SERVER_REMOTE_CLOSED;
- case WSAECONNRESET:
- gdb_con->closed = true;
- return ERROR_SERVER_REMOTE_CLOSED;
- default:
- LOG_ERROR("read: %d", errno);
- exit(-1);
- }
+ bool retry = (WSAGetLastError() == WSAEWOULDBLOCK);
#else
- switch (errno) {
- case EAGAIN:
- usleep(1000);
- break;
- case ECONNABORTED:
- gdb_con->closed = true;
- return ERROR_SERVER_REMOTE_CLOSED;
- case ECONNRESET:
- gdb_con->closed = true;
- return ERROR_SERVER_REMOTE_CLOSED;
- default:
- LOG_ERROR("read: %s", strerror(errno));
- gdb_con->closed = true;
- return ERROR_SERVER_REMOTE_CLOSED;
- }
+ bool retry = (errno == EAGAIN);
#endif
+
+ if (retry) {
+ // Try again after a delay
+ usleep(1000);
+ } else {
+ // Print error and close the socket
+ log_socket_error("GDB");
+ gdb_con->closed = true;
+ return ERROR_SERVER_REMOTE_CLOSED;
+ }
}
#ifdef _DEBUG_GDB_IO_
-----------------------------------------------------------------------
Summary of changes:
src/server/gdb_server.c | 43 ++++++++++++-----------------------------
src/target/semihosting_common.c | 3 ++-
2 files changed, 14 insertions(+), 32 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|