Check for exception after reading a register.
authorTim Newsome <tim@sifive.com>
Fri, 28 Oct 2016 21:01:42 +0000 (14:01 -0700)
committerTim Newsome <tim@sifive.com>
Fri, 28 Oct 2016 21:01:42 +0000 (14:01 -0700)
riscv/gdbserver.cc

index dc60a3e3b4e4d19435ac9fd22f950839d1169858..aeefb96d0fba943e6d6ea411a81a9776e00fef93 100644 (file)
@@ -636,14 +636,21 @@ class register_read_op_t : public operation_t
           return false;
 
         case 1:
-          gs.start_packet();
-          if (gs.xlen == 32) {
-            gs.send(gs.dr_read32(4));
-          } else {
-            gs.send(gs.dr_read(SLOT_DATA0));
+          {
+            unsigned result = gs.dr_read(SLOT_DATA_LAST);
+            if (result) {
+              gs.send_packet("E03");
+              return true;
+            }
+            gs.start_packet();
+            if (gs.xlen == 32) {
+              gs.send(gs.dr_read32(4));
+            } else {
+              gs.send(gs.dr_read(SLOT_DATA0));
+            }
+            gs.end_packet();
+            return true;
           }
-          gs.end_packet();
-          return true;
       }
       return false;
     }