From: openocd-gerrit <ope...@us...> - 2025-05-25 12:46:37
|
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 4fe57a0c197158958c7cc295002504d6434d4777 (commit) from bde7e86e8eb74097880af2cab81444b250712b18 (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 4fe57a0c197158958c7cc295002504d6434d4777 Author: Antonio Borneo <bor...@gm...> Date: Mon May 19 15:23:23 2025 +0200 server: gdb_server: use a macro for CTRL-C value The numeric value '3' for the ASCII character CTRL-C is not immediately readable, even if the lines that follow explicitly mention CTRL-C. Use the same macro present in `telnet_server.c` to replace the numeric value. Change-Id: Iaf4296b1f0e384f8122d8a4875cad17e8ddaf66a Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/8922 Reviewed-by: Tomas Vanek <va...@fb...> Tested-by: jenkins diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index bd00feb49..085058f4f 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -50,6 +50,8 @@ * found in most modern embedded processors. */ +#define CTRL(c) ((c) - '@') + enum gdb_output_flag { /* GDB doesn't accept 'O' packets */ GDB_OUTPUT_NO, @@ -434,7 +436,7 @@ static int gdb_put_packet_inner(struct connection *connection, gdb_putback_char(connection, reply); LOG_DEBUG("Unexpected start of new packet"); break; - } else if (reply == 0x3) { + } else if (reply == CTRL('C')) { /* do not discard Ctrl-C */ gdb_putback_char(connection, reply); break; @@ -486,7 +488,7 @@ static int gdb_put_packet_inner(struct connection *connection, gdb_con->output_flag = GDB_OUTPUT_NO; gdb_log_incoming_packet(connection, "-"); LOG_WARNING("negative reply, retrying"); - } else if (reply == 0x3) { + } else if (reply == CTRL('C')) { gdb_con->ctrl_c = true; gdb_log_incoming_packet(connection, "<Ctrl-C>"); retval = gdb_get_char(connection, &reply); @@ -696,7 +698,7 @@ static int gdb_get_packet_inner(struct connection *connection, gdb_log_incoming_packet(connection, "-"); LOG_WARNING("negative acknowledgment, but no packet pending"); break; - case 0x3: + case CTRL('C'): gdb_log_incoming_packet(connection, "<Ctrl-C>"); gdb_con->ctrl_c = true; *len = 0; ----------------------------------------------------------------------- Summary of changes: src/server/gdb_server.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |