diff options
author | Richard Xia <rxia@sifive.com> | 2016-10-18 11:31:25 -0700 |
---|---|---|
committer | Richard Xia <rxia@sifive.com> | 2016-10-18 11:31:25 -0700 |
commit | c5e29cf553799b0434e2635e3f42314af337a5b2 (patch) | |
tree | 08e7b500d018a39ce7638ad59df9938a18302070 /debug | |
parent | f59770c98f8f3a7762e8a1751cca922ba8afe870 (diff) | |
download | riscv-tests-c5e29cf553799b0434e2635e3f42314af337a5b2.zip riscv-tests-c5e29cf553799b0434e2635e3f42314af337a5b2.tar.gz riscv-tests-c5e29cf553799b0434e2635e3f42314af337a5b2.tar.bz2 |
Randomize gdb port.
Diffstat (limited to 'debug')
-rw-r--r-- | debug/testlib.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/debug/testlib.py b/debug/testlib.py index 0da09a1..29fa170 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -129,13 +129,19 @@ class Openocd(object): cmd += ["-f", find_file(config)] if debug: cmd.append("-d") + + # Assign port + self.port = unused_port() + print "Using port %d for gdb server" % self.port + # This command needs to come before any config scripts on the command + # line, since they are executed in order. + cmd[1:1] = ["--command", "gdb_port %d" % self.port] + logfile = open(Openocd.logname, "w") logfile.write("+ %s\n" % " ".join(cmd)) logfile.flush() self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=logfile, stderr=logfile) - # TODO: Pick a random port - self.port = 3333 # Wait for OpenOCD to have made it through riscv_examine(). When using # OpenOCD to communicate with a simulator this may take a long time, |