summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6ccc0bd)
Apparently the 32-bit compiler doesn't generate good enough debug info
for gdb to know what function we're in, which also means it doesn't know
where the local variables in those functions are stored.
def exit(self):
output = self.gdb.c()
self.assertIn("Breakpoint", output)
def exit(self):
output = self.gdb.c()
self.assertIn("Breakpoint", output)
- self.assertIn("_exit", output)
- self.assertEqual(self.gdb.p("status"), 0xc86455d4)
+ #TODO self.assertIn("_exit", output)
+ #TODO self.assertEqual(self.gdb.p("status"), 0xc86455d4)
+ # Use a0 until gdb can resolve "status"
+ self.assertEqual(self.gdb.p("$a0") & 0xffffffff, 0xc86455d4)
def test_turbostep(self):
"""Single step a bunch of times."""
def test_turbostep(self):
"""Single step a bunch of times."""
# The breakpoint should be hit exactly 2 times.
for i in range(2):
output = self.gdb.c()
# The breakpoint should be hit exactly 2 times.
for i in range(2):
output = self.gdb.c()
self.assertIn("Breakpoint ", output)
self.assertIn("Breakpoint ", output)
+ #TODO self.assertIn("rot13 ", output)
self.exit()
def test_registers(self):
self.exit()
def test_registers(self):
"""Sending gdb ^C while the program is running should cause it to halt."""
self.gdb.b("main:start")
self.gdb.c()
"""Sending gdb ^C while the program is running should cause it to halt."""
self.gdb.b("main:start")
self.gdb.c()
- self.gdb.command("p i=123");
self.gdb.c(wait=False)
time.sleep(0.1)
output = self.gdb.interrupt()
self.gdb.c(wait=False)
time.sleep(0.1)
output = self.gdb.interrupt()
- assert "main" in output
+ #TODO: assert "main" in output
self.assertGreater(self.gdb.p("j"), 10)
self.gdb.p("i=0");
self.exit()
self.assertGreater(self.gdb.p("j"), 10)
self.gdb.p("i=0");
self.exit()
self.assertIn("0xbead", output)
class Target(object):
self.assertIn("0xbead", output)
class Target(object):
def server(self):
raise NotImplementedError
def server(self):
raise NotImplementedError
return testlib.compile(sources +
("programs/entry.S", "programs/init.c",
"-I", "../env",
return testlib.compile(sources +
("programs/entry.S", "programs/init.c",
"-I", "../env",
- "-T", "targets/%s/link.lds" % self.name,
+ "-T", "targets/%s/link.lds" % (self.directory or self.name),
"-nostartfiles",
"-mcmodel=medany"), xlen=self.xlen)
"-nostartfiles",
"-mcmodel=medany"), xlen=self.xlen)
-class SpikeTarget(Target):
+class Spike64Target(Target):
name = "spike"
xlen = 64
ram = 0x80010000
name = "spike"
xlen = 64
ram = 0x80010000
def server(self):
return testlib.Spike(parsed.cmd, halted=True)
def server(self):
return testlib.Spike(parsed.cmd, halted=True)
+class Spike32Target(Target):
+ name = "spike32"
+ directory = "spike"
+ xlen = 32
+ ram = 0x80010000
+
+ def server(self):
+ return testlib.Spike(parsed.cmd, halted=True, xlen=32)
+
class MicroSemiTarget(Target):
name = "m2gl_m2s"
xlen = 32
class MicroSemiTarget(Target):
name = "m2gl_m2s"
xlen = 32
config="targets/%s/openocd.cfg" % self.name)
targets = [
config="targets/%s/openocd.cfg" % self.name)
targets = [
+ Spike32Target,
+ Spike64Target,
+// TODO: These should be local to main, but if I make them global then gdb can
+// find them.
+static volatile int i;
+static int j;
- volatile int i = 0;
- int j = 0;
char *fox = "The quick brown fox jumps of the lazy dog.";
unsigned int checksum = 0;
char *fox = "The quick brown fox jumps of the lazy dog.";
unsigned int checksum = 0;
return port
class Spike(object):
return port
class Spike(object):
- def __init__(self, cmd, binary=None, halted=False, with_gdb=True, timeout=None):
+ def __init__(self, cmd, binary=None, halted=False, with_gdb=True, timeout=None,
+ xlen=64):
"""Launch spike. Return tuple of its process and the port it's running on."""
if cmd:
cmd = shlex.split(cmd)
else:
cmd = ["spike"]
"""Launch spike. Return tuple of its process and the port it's running on."""
if cmd:
cmd = shlex.split(cmd)
else:
cmd = ["spike"]
+ if (xlen == 32):
+ cmd += ["--isa", "RV32"]
if timeout:
cmd = ["timeout", str(timeout)] + cmd
if timeout:
cmd = ["timeout", str(timeout)] + cmd
self.child = pexpect.spawn(path)
self.child.logfile = file("gdb.log", "w")
self.wait()
self.child = pexpect.spawn(path)
self.child.logfile = file("gdb.log", "w")
self.wait()
+ self.command("set confirm off")
self.command("set width 0")
self.command("set height 0")
# Force consistency.
self.command("set width 0")
self.command("set height 0")
# Force consistency.