gdb-server: fix error reporting bugs
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 7 Jun 2010 13:14:04 +0000 (15:14 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 8 Jun 2010 08:37:03 +0000 (10:37 +0200)
GDB and OpenOCD has two different error number
spaces and no mapping exists between them.

If a specific error number is to be reported
to GDB then this has to be done at the calling
site, rather than as a generic routine that
tries to map "retval" to GDB error number speak.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/server/gdb_server.c

index a84c618aff084177becbf0c85e9918e0a880c383..029bdf8131ff2f6534d7c00b9aa198e26efbce39 100644 (file)
@@ -1219,29 +1219,14 @@ static int gdb_set_register_packet(struct connection *connection,
        return ERROR_OK;
 }
 
+/* No attempt is made to translate the "retval" to
+ * GDB speak. This has to be done at the calling
+ * site as no mapping really exists.
+ */
 static int gdb_error(struct connection *connection, int retval)
 {
-       switch (retval)
-       {
-               case ERROR_TARGET_DATA_ABORT:
-                       gdb_send_error(connection, EIO);
-                       break;
-               case ERROR_TARGET_TRANSLATION_FAULT:
-                       gdb_send_error(connection, EFAULT);
-                       break;
-               case ERROR_TARGET_UNALIGNED_ACCESS:
-                       gdb_send_error(connection, EFAULT);
-                       break;
-               case ERROR_TARGET_NOT_HALTED:
-                       gdb_send_error(connection, EFAULT);
-                       break;
-               default:
-                       /* This could be that the target reset itself. */
-                       LOG_ERROR("unexpected error %i", retval);
-                       gdb_send_error(connection, EFAULT);
-                       break;
-       }
-
+       LOG_DEBUG("Reporting %i to GDB as generic error", retval);
+       gdb_send_error(connection, EFAULT);
        return ERROR_OK;
 }
 
@@ -1719,7 +1704,7 @@ static int gdb_memory_map(struct connection *connection,
                if (retval != ERROR_OK)
                {
                        free(banks);
-                       gdb_send_error(connection, retval);
+                       gdb_error(connection, retval);
                        return retval;
                }
                banks[i] = p;
@@ -1801,7 +1786,7 @@ static int gdb_memory_map(struct connection *connection,
        xml_printf(&retval, &xml, &pos, &size, "</memory-map>\n");
 
        if (retval != ERROR_OK) {
-               gdb_send_error(connection, retval);
+               gdb_error(connection, retval);
                return retval;
        }
 
@@ -1952,7 +1937,7 @@ static int gdb_query_packet(struct connection *connection,
 
                if (retval != ERROR_OK)
                {
-                       gdb_send_error(connection, retval);
+                       gdb_error(connection, retval);
                        return retval;
                }
 

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)