#include "rtos/rtos.h"
#include "target/smp.h"
-
/**
* @file
* GDB server implementation.
bool mem_write_error;
};
-
#if 0
#define _DEBUG_GDB_IO_
#endif
}
#ifdef _DEBUG_GDB_IO_
- debug_buffer = malloc(gdb_con->buf_cnt + 1);
- memcpy(debug_buffer, gdb_con->buffer, gdb_con->buf_cnt);
- debug_buffer[gdb_con->buf_cnt] = 0;
+ debug_buffer = strndup(gdb_con->buffer, gdb_con->buf_cnt);
LOG_DEBUG("received '%s'", debug_buffer);
free(debug_buffer);
#endif
while (1)
{
#ifdef _DEBUG_GDB_IO_
- debug_buffer = malloc(len + 1);
- memcpy(debug_buffer, buffer, len);
- debug_buffer[len] = 0;
+ debug_buffer = strndup(buffer, len);
LOG_DEBUG("sending packet '$%s#%2.2x'", debug_buffer, my_checksum);
free(debug_buffer);
#endif