summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-06-07 15:14:04 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-06-08 10:37:03 +0200
commit54f3f8e4c1477bec077e132cdccd8097938332e2 (patch)
tree341a1ed52768e896acaa4dd2ccd7fd5ba31983e9 /src/server
parent00635e28ba5c405742cae261d8551f165dc78ba3 (diff)
downloadopenocd+libswd-54f3f8e4c1477bec077e132cdccd8097938332e2.tar.gz
openocd+libswd-54f3f8e4c1477bec077e132cdccd8097938332e2.tar.bz2
openocd+libswd-54f3f8e4c1477bec077e132cdccd8097938332e2.tar.xz
openocd+libswd-54f3f8e4c1477bec077e132cdccd8097938332e2.zip
gdb-server: fix error reporting bugs
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>
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index a84c618a..029bdf81 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -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;
}