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 <hello@icmd.tech> Reviewed-on: https://review.openocd.org/c/openocd/+/9461 Tested-by: jenkins Reviewed-by: Evgeniy Naydanov <eugnay@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
092282c7d2
commit
22e1e1b33e
@@ -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':
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user