void handle_register_write(const std::vector<uint8_t> &packet);
void handle_step(const std::vector<uint8_t> &packet);
+ bool connected() const { return client_fd > 0; }
+
private:
sim_t *sim;
int socket_fd;
fprintf(stderr, "core %3d: exception %s, epc 0x%016" PRIx64 "\n",
id, t.name(), epc);
- if (t.cause() == CAUSE_BREAKPOINT) {
- // TODO: Only do this if there is a debugger attached.
+ if (t.cause() == CAUSE_BREAKPOINT &&
+ sim->gdbserver && sim->gdbserver->connected()) {
set_halted(true, HR_SWBP);
return;
}
def setUp(self):
self.binary = testlib.compile("ebreak.s")
- def test_ebreak(self):
- """Make sure that we can run past ebreak without halting when a
- debugger isn't attached."""
+ def test_noport(self):
+ """Make sure that we can run past ebreak when --gdb-port isn't used."""
spike = testlib.spike(self.binary, with_gdb=False, timeout=10)
result = spike.wait()
self.assertEqual(result, 0)
+ def test_nogdb(self):
+ """Make sure that we can run past ebreak when gdb isn't attached."""
+ spike, port = testlib.spike(self.binary, timeout=10)
+ result = spike.wait()
+ self.assertEqual(result, 0)
+
if __name__ == '__main__':
unittest.main()