Add gdb_setup to target for arbitrary gdb commands
authorTim Newsome <tim@sifive.com>
Mon, 3 Jul 2017 17:48:58 +0000 (10:48 -0700)
committerTim Newsome <tim@sifive.com>
Mon, 3 Jul 2017 17:48:58 +0000 (10:48 -0700)
I'm using this for a target where misa is at an old address, to
set riscv use_compressed_breakpoints off

debug/targets.py
debug/testlib.py

index 1f4b176144a84ba89da5ce34ebb989eebe30f775..ae81517654f85d705b29e607d26d88ac0918219e 100644 (file)
@@ -30,6 +30,10 @@ class Target(object):
     # save a little time.
     misa = None
 
+    # List of commands that should be executed in gdb after connecting but
+    # before starting the test.
+    gdb_setup = []
+
     # Internal variables:
     directory = None
     temporary_files = []
index f511088cf53e81c8fb9607db2c7aa3405e6d2b48..c44a763f212837bfe509e941a07d36f303f19d0a 100644 (file)
@@ -622,6 +622,9 @@ class GdbTest(BaseTest):
             thread = random.choice(self.gdb.threads())
             self.gdb.thread(thread)
 
+        for cmd in self.target.gdb_setup:
+            self.gdb.command(cmd)
+
         # FIXME: OpenOCD doesn't handle PRIV now
         #self.gdb.p("$priv=3")