From 311680cad866d9a2a13aec44a1b615eb6cebe6a5 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 14 Aug 2017 15:24:41 -0700 Subject: [PATCH] Put logfile code back so everything works again. I don't exactly understand why it has to be the way it is, but I just want it to work. Also fix a pylint complaint. --- debug/targets.py | 4 ++-- debug/testlib.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debug/targets.py b/debug/targets.py index 37759f9..7183a38 100644 --- a/debug/targets.py +++ b/debug/targets.py @@ -24,8 +24,8 @@ class Target(object): # Timeout waiting for the server to start up. This is different than the # GDB timeout, which is how long GDB waits for commands to execute. - # The server_timeout is how long this script waits for the Server to be ready - # for GDB connections. + # The server_timeout is how long this script waits for the Server to be + # ready for GDB connections. server_timeout_sec = 60 # Path to linker script relative to the .py file where the target is diff --git a/debug/testlib.py b/debug/testlib.py index 23f937b..b76f320 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -197,7 +197,7 @@ class Openocd(object): if debug: cmd.append("-d") - logfile = Openocd.logfile + logfile = open(Openocd.logname, "w") logfile.write("+ %s\n" % " ".join(cmd)) logfile.flush() self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE, @@ -282,7 +282,8 @@ class Gdb(object): def __init__(self, cmd=os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gdb")): self.child = pexpect.spawn(cmd) - Gdb.logfile.write("+ %s\n" % cmd) + self.child.logfile = open(self.logname, "w") + self.child.logfile.write("+ %s\n" % cmd) self.wait() self.command("set confirm off") self.command("set width 0") -- 2.30.2