aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2020-03-26 09:46:32 -0700
committerGitHub <noreply@github.com>2020-03-26 09:46:32 -0700
commit60eccb29677560e58a3133ec43c7185892024316 (patch)
tree3cb43c9e88fc5f380899c03db5138b0f6816cd8b /src/server
parent5b2426a4b2c3d0eb244bb8ec276ef24228e9e31d (diff)
downloadriscv-openocd-60eccb29677560e58a3133ec43c7185892024316.zip
riscv-openocd-60eccb29677560e58a3133ec43c7185892024316.tar.gz
riscv-openocd-60eccb29677560e58a3133ec43c7185892024316.tar.bz2
Use the correct thread for memory accesses. (#459)
* Deal with vlenb being unreadable. Instead of exiting during examine(), spit out a warning, and don't expose the vector data registers. We do provide access to the vector CSRs, because maybe they do work? It's just that we have no idea what the size of the data registers is. Change-Id: I6e9ffeb242e2e22fc62cb1b50782c2efb4ace0bd * WIP Change-Id: I46292eefe537aeaf72bdd44e4aa58298b5120b00 * Use the correct thread for memory accesses. Previously, OpenOCD would perform RTOS memory accesses through the first thread in the RTOS. This doesn't work if different threads have a different memory view. For instance if `-rtos hwthread` is used, each configured core could have address translation configured differently. Change-Id: I61328c8f50065ecba5ce1797dbeaee482812f799
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index d4ad72d..755463c 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -1425,7 +1425,7 @@ static int gdb_read_memory_packet(struct connection *connection,
uint8_t *buffer;
char *hex_buffer;
- int retval = ERROR_OK;
+ int retval;
/* skip command character */
packet++;
@@ -1449,7 +1449,11 @@ static int gdb_read_memory_packet(struct connection *connection,
LOG_DEBUG("addr: 0x%16.16" PRIx64 ", len: 0x%8.8" PRIx32 "", addr, len);
- retval = target_read_buffer(target, addr, len, buffer);
+ retval = ERROR_NOT_IMPLEMENTED;
+ if (target->rtos != NULL)
+ retval = rtos_read_buffer(target, addr, len, buffer);
+ if (retval == ERROR_NOT_IMPLEMENTED)
+ retval = target_read_buffer(target, addr, len, buffer);
if ((retval != ERROR_OK) && !gdb_report_data_abort) {
/* TODO : Here we have to lie and send back all zero's lest stack traces won't work.
@@ -1520,7 +1524,11 @@ static int gdb_write_memory_packet(struct connection *connection,
if (unhexify(buffer, separator, len) != len)
LOG_ERROR("unable to decode memory packet");
- retval = target_write_buffer(target, addr, len, buffer);
+ retval = ERROR_NOT_IMPLEMENTED;
+ if (target->rtos != NULL)
+ retval = rtos_write_buffer(target, addr, len, buffer);
+ if (retval == ERROR_NOT_IMPLEMENTED)
+ retval = target_write_buffer(target, addr, len, buffer);
if (retval == ERROR_OK)
gdb_put_packet(connection, "OK", 2);
@@ -1589,7 +1597,12 @@ static int gdb_write_memory_binary_packet(struct connection *connection,
if (len) {
LOG_DEBUG("addr: 0x%" PRIx64 ", len: 0x%8.8" PRIx32 "", addr, len);
- retval = target_write_buffer(target, addr, len, (uint8_t *)separator);
+ retval = ERROR_NOT_IMPLEMENTED;
+ if (target->rtos != NULL)
+ retval = rtos_write_buffer(target, addr, len, (uint8_t *)separator);
+ if (retval == ERROR_NOT_IMPLEMENTED)
+ retval = target_write_buffer(target, addr, len, (uint8_t *)separator);
+
if (retval != ERROR_OK)
gdb_connection->mem_write_error = true;
}