server: Allow 64 address to be send over GBD server

Accept 64 bit addresses from GDB read memory packet.
Also allow breakpoint/stepping addresses to take 64bit values.

Change-Id: I9bf7b44affe24839cf30897c55ad17fdd29edf14
Signed-off-by: David Ung <david.ung.42@gmail.com>
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
This commit is contained in:
David Ung 2015-01-16 17:22:00 -08:00 committed by Matthias Welwarsky
parent 47b8cf8420
commit ea45db5c8a

View File

@ -1355,7 +1355,7 @@ static int gdb_read_memory_packet(struct connection *connection,
{
struct target *target = get_target_from_connection(connection);
char *separator;
uint32_t addr = 0;
uint64_t addr = 0;
uint32_t len = 0;
uint8_t *buffer;
@ -1366,7 +1366,7 @@ static int gdb_read_memory_packet(struct connection *connection,
/* skip command character */
packet++;
addr = strtoul(packet, &separator, 16);
addr = strtoull(packet, &separator, 16);
if (*separator != ',') {
LOG_ERROR("incomplete read memory packet received, dropping connection");
@ -1383,7 +1383,7 @@ static int gdb_read_memory_packet(struct connection *connection,
buffer = malloc(len);
LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
LOG_DEBUG("addr: 0x%16.16" PRIx64 ", len: 0x%8.8" PRIx32 "", addr, len);
retval = target_read_buffer(target, addr, len, buffer);
@ -1426,7 +1426,7 @@ static int gdb_write_memory_packet(struct connection *connection,
{
struct target *target = get_target_from_connection(connection);
char *separator;
uint32_t addr = 0;
uint64_t addr = 0;
uint32_t len = 0;
uint8_t *buffer;
@ -1435,7 +1435,7 @@ static int gdb_write_memory_packet(struct connection *connection,
/* skip command character */
packet++;
addr = strtoul(packet, &separator, 16);
addr = strtoull(packet, &separator, 16);
if (*separator != ',') {
LOG_ERROR("incomplete write memory packet received, dropping connection");
@ -1451,7 +1451,7 @@ static int gdb_write_memory_packet(struct connection *connection,
buffer = malloc(len);
LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
LOG_DEBUG("addr: 0x%" PRIx64 ", len: 0x%8.8" PRIx32 "", addr, len);
if (unhexify(buffer, separator, len) != len)
LOG_ERROR("unable to decode memory packet");
@ -1473,7 +1473,7 @@ static int gdb_write_memory_binary_packet(struct connection *connection,
{
struct target *target = get_target_from_connection(connection);
char *separator;
uint32_t addr = 0;
uint64_t addr = 0;
uint32_t len = 0;
int retval = ERROR_OK;
@ -1485,7 +1485,7 @@ static int gdb_write_memory_binary_packet(struct connection *connection,
/* skip command character */
packet++;
addr = strtoul(packet, &separator, 16);
addr = strtoull(packet, &separator, 16);
if (*separator != ',') {
LOG_ERROR("incomplete write memory binary packet received, dropping connection");
@ -1523,7 +1523,7 @@ static int gdb_write_memory_binary_packet(struct connection *connection,
}
if (len) {
LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
LOG_DEBUG("addr: 0x%" PRIx64 ", len: 0x%8.8" PRIx32 "", addr, len);
retval = target_write_buffer(target, addr, len, (uint8_t *)separator);
if (retval != ERROR_OK)
@ -1547,13 +1547,13 @@ static int gdb_step_continue_packet(struct connection *connection,
{
struct target *target = get_target_from_connection(connection);
int current = 0;
uint32_t address = 0x0;
uint64_t address = 0x0;
int retval = ERROR_OK;
LOG_DEBUG("-");
if (packet_size > 1)
address = strtoul(packet + 1, NULL, 16);
address = strtoull(packet + 1, NULL, 16);
else
current = 1;
@ -1577,7 +1577,7 @@ static int gdb_breakpoint_watchpoint_packet(struct connection *connection,
int type;
enum breakpoint_type bp_type = BKPT_SOFT /* dummy init to avoid warning */;
enum watchpoint_rw wp_type = WPT_READ /* dummy init to avoid warning */;
uint32_t address;
uint64_t address;
uint32_t size;
char *separator;
int retval;
@ -1609,7 +1609,7 @@ static int gdb_breakpoint_watchpoint_packet(struct connection *connection,
return ERROR_SERVER_REMOTE_CLOSED;
}
address = strtoul(separator + 1, &separator, 16);
address = strtoull(separator + 1, &separator, 16);
if (*separator != ',') {
LOG_ERROR("incomplete breakpoint/watchpoint packet received, dropping connection");