|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:22:24
|
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 22e1e1b33e844c343eb3f24d24f630e2471d2b27 (commit)
from 092282c7d27141df23a6055f9ee216da32494401 (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 22e1e1b33e844c343eb3f24d24f630e2471d2b27
Author: Cristian Dinca <he...@ic...>
Date: Fri Feb 13 15:50:48 2026 +0200
target/smp: reply to unknown packets in gdb_read_smp_packet
Some clients probe or use SMP-related 'j' packets. If OpenOCD
received an unknown 'j' packet, gdb_read_smp_packet previously did
not send any reply. This may result cause the client to hang while
waiting for a response.
Send an empty reply packet for unsupported 'j' packets.
Change-Id: I84c5e8e99f946d41dd5c11163c3eeb8af2b6c90f
Signed-off-by: Cristian Dinca <he...@ic...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9461
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <eu...@gm...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index cf7a2bde0..f59eb5029 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -3753,18 +3753,30 @@ static int gdb_input_inner(struct connection *connection)
break;
case 'j':
- /* DEPRECATED */
- /* packet supported only by smp target i.e cortex_a.c*/
- /* handle smp packet replying coreid played to gbd */
- gdb_read_smp_packet(connection, packet, packet_size);
+ if (strncmp(packet, "jc", 2) == 0) {
+ /* DEPRECATED */
+ /* packet supported only by smp target i.e cortex_a.c*/
+ /* handle smp packet replying coreid played to gbd */
+ gdb_read_smp_packet(connection, packet, packet_size);
+ } else {
+ /* ignore unknown packets */
+ LOG_DEBUG("ignoring 0x%2.2x packet", packet[0]);
+ retval = gdb_put_packet(connection, "", 0);
+ }
break;
case 'J':
- /* DEPRECATED */
- /* packet supported only by smp target i.e cortex_a.c */
- /* handle smp packet setting coreid to be played at next
- * resume to gdb */
- gdb_write_smp_packet(connection, packet, packet_size);
+ if (strncmp(packet, "jc", 2) == 0) {
+ /* DEPRECATED */
+ /* packet supported only by smp target i.e cortex_a.c */
+ /* handle smp packet setting coreid to be played at next
+ * resume to gdb */
+ gdb_read_smp_packet(connection, packet, packet_size);
+ } else {
+ /* ignore unknown packets */
+ LOG_DEBUG("ignoring 0x%2.2x packet", packet[0]);
+ retval = gdb_put_packet(connection, "", 0);
+ }
break;
case 'F':
diff --git a/src/target/smp.c b/src/target/smp.c
index 41ca880d4..8a9dd2d9d 100644
--- a/src/target/smp.c
+++ b/src/target/smp.c
@@ -54,16 +54,13 @@ int gdb_read_smp_packet(struct connection *connection,
LOG_WARNING(DEPRECATED_MSG);
if (target->smp) {
- if (strncmp(packet, "jc", 2) == 0) {
- const uint32_t len = sizeof(target->gdb_service->core[0]);
- char hex_buffer[len * 2 + 1];
- uint8_t buffer[len];
- buf_set_u32(buffer, 0, len * 8, target->gdb_service->core[0]);
- size_t pkt_len = hexify(hex_buffer, buffer, sizeof(buffer),
- sizeof(hex_buffer));
-
- retval = gdb_put_packet(connection, hex_buffer, pkt_len);
- }
+ const uint32_t len = sizeof(target->gdb_service->core[0]);
+ char hex_buffer[len * 2 + 1];
+ uint8_t buffer[len];
+ buf_set_u32(buffer, 0, len * 8, target->gdb_service->core[0]);
+ size_t pkt_len = hexify(hex_buffer, buffer, sizeof(buffer),
+ sizeof(hex_buffer));
+ retval = gdb_put_packet(connection, hex_buffer, pkt_len);
} else
retval = gdb_put_packet(connection, "E01", 3);
return retval;
-----------------------------------------------------------------------
Summary of changes:
src/server/gdb_server.c | 30 +++++++++++++++++++++---------
src/target/smp.c | 17 +++++++----------
2 files changed, 28 insertions(+), 19 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|