Merge pull request #83 from bacam/gdb-protocol-fixes
[riscv-isa-sim.git] / riscv / gdbserver.cc
index 920cb8f833490fa6db8ca85fd9f7e3c25babc52c..79284ebf3fb5c2fbac3dd588e82d45df43cc5bc1 100644 (file)
@@ -325,7 +325,7 @@ void circular_buffer_t<T>::append(const T *src, unsigned int count)
   count -= copy;
   if (count > 0) {
     assert(count < contiguous_empty_size());
-    memcpy(contiguous_empty(), src, count * sizeof(T));
+    memcpy(contiguous_empty(), src+copy, count * sizeof(T));
     data_added(count);
   }
 }
@@ -652,7 +652,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;
@@ -732,7 +732,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;