`./gdbserver.py --spike32 --cmd $RISCV/bin/spike`
-32-bit SiFive Core on Microsemi FPGA board
-------------------------------------------
+32-bit SiFive Core on Arty FPGA board
+-------------------------------------
-`./gdbserver.py --m2gl_m2s`
+`./gdbserver.py --freedom-e300`
Debug Tips
==========
You can see what spike is doing by add `-l` to the spike command, eg.:
`./gdbserver.py --spike32 --cmd "$RISCV/bin/spike -l"
DebugTest.test_breakpoint`. (Then look at spike.log.)
+
+You can run gdb under valgrind by passing --gdb, eg.: `./gdbserver.py --spike64
+--gdb "valgrind riscv64-unknown-elf-gdb" -- -v DownloadTest`.
MSTATUS32_SD = 0x80000000
MSTATUS64_SD = 0x8000000000000000
+def gdb():
+ if parsed.gdb:
+ return testlib.Gdb(parsed.gdb)
+ else:
+ return testlib.Gdb()
+
def ihex_line(address, record_type, data):
assert len(data) < 128
line = ":%02X%04X%02X" % (len(data), address, record_type)
class SimpleRegisterTest(DeleteServer):
def setUp(self):
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
# For now gdb has to be told what the architecture is when it's not
# given an ELF file.
self.gdb.command("set arch riscv:rv%d" % target.xlen)
class SimpleMemoryTest(DeleteServer):
def setUp(self):
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("set arch riscv:rv%d" % target.xlen)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
class InstantHaltTest(DeleteServer):
def setUp(self):
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("set arch riscv:rv%d" % target.xlen)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
self.binary = target.compile("programs/debug.c", "programs/checksum.c",
"programs/tiny-malloc.c", "-DDEFINE_MALLOC", "-DDEFINE_FREE")
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("file %s" % self.binary)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
self.gdb.load()
def setUp(self):
self.binary = target.compile("programs/step.S")
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("file %s" % self.binary)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
self.gdb.load()
def setUp(self):
self.binary = target.compile("programs/regs.S")
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("file %s" % self.binary)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
self.gdb.load()
self.binary = target.compile(download_c.name, "programs/checksum.c")
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("file %s" % self.binary)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
def setUp(self):
self.binary = target.compile("programs/mprv.S")
self.server = target.server()
- self.gdb = testlib.Gdb()
+ self.gdb = gdb()
self.gdb.command("file %s" % self.binary)
self.gdb.command("target extended-remote localhost:%d" % self.server.port)
self.gdb.load()
dest="target")
parser.add_argument("--cmd",
help="The command to use to start the debug server.")
+ parser.add_argument("--gdb",
+ help="The command to use to start gdb.")
parser.add_argument("--isolate", action="store_true",
help="Try to run in such a way that multiple instances can run at "
"the same time. This may make it harder to debug a failure if it "