From 651ad043cee90de1c80d07b70a12c81d26b48c95 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Sun, 13 Mar 2016 13:13:15 -0700 Subject: [PATCH] Add some tests that pass and test something. --- Makefile.in | 2 +- riscv/gdbserver.cc | 6 ++--- tests/debug.c | 27 ++++++++++++++++++++++ tests/gdbserver-smoke.py | 49 ++++++++++++++++++++++++++++++++++++++++ tests/testlib.py | 46 +++++++++++++++++++++++++++++++++++++ 5 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 tests/debug.c create mode 100755 tests/gdbserver-smoke.py create mode 100644 tests/testlib.py diff --git a/Makefile.in b/Makefile.in index 1e353ab..a0f119a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -335,7 +335,7 @@ deps : $(deps) bintest_outs = $(bintests:=.out) junk += $(bintest_outs) %.out: % all - ./$^ < /dev/null 2>&1 | tee $@ + ./$* < /dev/null 2>&1 | tee $@ check-cpp : $(test_outs) echo; grep -h -e'Unit Tests' -e'FAILED' -e'Segmentation' $^ < /dev/null; echo diff --git a/riscv/gdbserver.cc b/riscv/gdbserver.cc index 70dac13..39bfdf8 100644 --- a/riscv/gdbserver.cc +++ b/riscv/gdbserver.cc @@ -529,7 +529,8 @@ void gdbserver_t::handle_breakpoint(const std::vector &packet) return send_packet("E53"); } - mmu_t* mmu = sim->debug_mmu; + processor_t *p = sim->get_core(0); + mmu_t* mmu = p->mmu; if (insert) { bp.insert(mmu); breakpoints[bp.address] = bp; @@ -540,8 +541,7 @@ void gdbserver_t::handle_breakpoint(const std::vector &packet) breakpoints.erase(bp.address); } mmu->flush_icache(); - processor_t *p = sim->get_core(0); - p->mmu->flush_icache(); + sim->debug_mmu->flush_icache(); return send_packet("OK"); } diff --git a/tests/debug.c b/tests/debug.c new file mode 100644 index 0000000..2cad88f --- /dev/null +++ b/tests/debug.c @@ -0,0 +1,27 @@ +#include + +char c = 'x'; + +void print_row(int length) +{ + for (int x=0; x