```
int gdb_read_smp_packet(struct connection *connection,
                char const *packet, int packet_size)
{
        struct target *target = get_target_from_connection(connection);
        int retval = ERROR_OK;

        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);
                }
        // BUG: <-- MISSING ELSE HERE
        } else
                retval = gdb_put_packet(connection, "E01", 3);
        return retval;
}
```
should have `else` with:
```
gdb_put_packet(connection, "", 0);
```



---

**[tickets:#449] GDB Server Should Return an Empty Response for Undefined GDB 
Packets**

**Status:** new
**Milestone:** 0.10.0
**Created:** Wed Feb 12, 2025 07:01 PM UTC by patryk sondej
**Last Updated:** Wed Feb 12, 2025 07:01 PM UTC
**Owner:** nobody


Hi.
Not all undefined GDB packets return an empty response.
This is issue when debugging using LLDB. Since the openocd does not immediately 
return an empty response, each `nexti` command becomes very slow due to LLDB 
waiting for a receive timeout.

Eg:
```
(gdb) maintenance packet jThreadsInfo
sending: jThreadsInfo
Ignoring packet error, continuing...
error while fetching packet from remote target

(gdb) maintenance packet xxx
sending: xxx
received: ""

(gdb) maintenance packet jxxx
sending: jxxx
Ignoring packet error, continuing...
error while fetching packet from remote target
```

I found out, a lot of gdb packets in openocd has missing `else` with empty 
response.


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to