server: Allow 64 address to be send over GBD server 98/2498/15
authorDavid Ung <davidu@nvidia.com>
Sat, 17 Jan 2015 01:22:00 +0000 (17:22 -0800)
committerMatthias Welwarsky <matthias.welwarsky@sysgo.com>
Fri, 10 Feb 2017 12:51:00 +0000 (13:51 +0100)
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>
src/server/gdb_server.c

index c293f5b057235f829bd6228c94b0459c23dff4b9..483e5510b115234d5d4243fa5cb8c9e8d7b6a1e7 100644 (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");

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)