Display env variables used when invoking OpenOCD
authorTim Newsome <tim@sifive.com>
Tue, 12 Dec 2017 16:02:38 +0000 (08:02 -0800)
committerTim Newsome <tim@sifive.com>
Tue, 12 Dec 2017 16:02:38 +0000 (08:02 -0800)
This makes it a little easier to just cut and paste from the log when
reproducing a failure. (The port number still needs changing though.)

debug/testlib.py
env

index 21eeb3d511c55b91ed52a29e3381b21a13bc48d6..39a6fc4b9e1c936acb7893b186d163bfc3e360b1 100644 (file)
@@ -9,6 +9,7 @@ import sys
 import tempfile
 import time
 import traceback
+import pipes
 
 import pexpect
 
@@ -237,7 +238,11 @@ class Openocd(object):
         logfile = open(Openocd.logname, "w")
         if print_log_names:
             real_stdout.write("Temporary OpenOCD log: %s\n" % Openocd.logname)
-        logfile.write("+ %s\n" % " ".join(cmd))
+        env_entries = ("REMOTE_BITBANG_HOST", "REMOTE_BITBANG_PORT")
+        env_entries = [key for key in env_entries if key in os.environ]
+        logfile.write("+ %s%s\n" % (
+            "".join("%s=%s " % (key, os.environ[key]) for key in env_entries),
+            " ".join(map(pipes.quote, cmd))))
         logfile.flush()
 
         self.gdb_ports = []
diff --git a/env b/env
index 68cad7baf3ed0a4553fffd14726d24519ee1296a..db0bfa223142e56b17dae6d92610f195014bbb80 160000 (submodule)
--- a/env
+++ b/env
@@ -1 +1 @@
-Subproject commit 68cad7baf3ed0a4553fffd14726d24519ee1296a
+Subproject commit db0bfa223142e56b17dae6d92610f195014bbb80