/* private connection data for GDB */
struct gdb_connection {
- char buffer[GDB_BUFFER_SIZE];
+ char buffer[GDB_BUFFER_SIZE + 1]; /* Extra byte for nul-termination */
char *buf_p;
int buf_cnt;
int ctrl_c;
static int gdb_target_callback_event_handler(struct target *target,
enum target_event event, void *priv)
{
- int retval;
struct connection *connection = priv;
struct gdb_service *gdb_service = connection->service->priv;
case TARGET_EVENT_HALTED:
target_call_event_callbacks(target, TARGET_EVENT_GDB_END);
break;
- case TARGET_EVENT_GDB_FLASH_ERASE_START:
- retval = jtag_execute_queue();
- if (retval != ERROR_OK)
- return retval;
- break;
default:
break;
}
/* We don't have to worry about the default 2 second timeout for GDB packets,
* because GDB breaks up large memory reads into smaller reads.
- *
- * 8191 bytes by the looks of it. Why 8191 bytes instead of 8192?????
*/
static int gdb_read_memory_packet(struct connection *connection,
char const *packet, int packet_size)
&pos,
&size,
"PacketSize=%x;qXfer:memory-map:read%c;qXfer:features:read%c;qXfer:threads:read+;QStartNoAckMode+;vContSupported+",
- (GDB_BUFFER_SIZE - 1),
+ GDB_BUFFER_SIZE,
((gdb_use_memory_map == 1) && (flash_get_bank_count() > 0)) ? '+' : '-',
(gdb_target_desc_supported == 1) ? '+' : '-');
static int gdb_input_inner(struct connection *connection)
{
/* Do not allocate this on the stack */
- static char gdb_packet_buffer[GDB_BUFFER_SIZE];
+ static char gdb_packet_buffer[GDB_BUFFER_SIZE + 1]; /* Extra byte for nul-termination */
struct target *target;
char const *packet = gdb_packet_buffer;
* drain the rest of the buffer.
*/
do {
- packet_size = GDB_BUFFER_SIZE-1;
+ packet_size = GDB_BUFFER_SIZE;
retval = gdb_get_packet(connection, gdb_packet_buffer, &packet_size);
if (retval != ERROR_OK)
return retval;