Only read exception flag in gdb register read/write. (#85)
authorBrian Campbell <bacam@z273.org.uk>
Fri, 30 Dec 2016 21:14:50 +0000 (21:14 +0000)
committerAndrew Waterman <aswaterman@gmail.com>
Fri, 30 Dec 2016 21:14:50 +0000 (15:14 -0600)
The flag is 32 bits, and if we read 64/128 bits then we get fragments of
S1 too and can accidentally send an error.  Fixes #84.

riscv/gdbserver.cc

index 4303adfed38a6cbecbf8cce251a2f397331e4f80..7e83c49b118f7896fb5b93b1529c197f1fe21475 100644 (file)
@@ -648,7 +648,7 @@ class register_read_op_t : public operation_t
 
         case 1:
           {
-            unsigned result = gs.dr_read(SLOT_DATA_LAST);
+            unsigned result = gs.dr_read32(DEBUG_RAM_SIZE / 4 - 1);
             if (result) {
               gs.send_packet("E03");
               return true;
@@ -728,7 +728,7 @@ class register_write_op_t : public operation_t
 
         case 1:
           {
-            unsigned result = gs.dr_read(SLOT_DATA_LAST);
+            unsigned result = gs.dr_read32(DEBUG_RAM_SIZE / 4 - 1);
             if (result) {
               gs.send_packet("E03");
               return true;