From cfe2798748bd8fa4db21124026ad4ea35e310006 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 3 Jul 2017 10:48:58 -0700 Subject: [PATCH] Add gdb_setup to target for arbitrary gdb commands I'm using this for a target where misa is at an old address, to set riscv use_compressed_breakpoints off --- debug/targets.py | 4 ++++ debug/testlib.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/debug/targets.py b/debug/targets.py index 1f4b176..ae81517 100644 --- a/debug/targets.py +++ b/debug/targets.py @@ -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 = [] diff --git a/debug/testlib.py b/debug/testlib.py index f511088..c44a763 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -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") -- 2.30.2