if self.target.instruction_hardware_breakpoint_count < 1:
return 'not_applicable'
+ if not self.target.honors_tdata1_hmode:
+ # Run to main before setting the breakpoint, because startup code
+ # will otherwise clear the trigger that we set.
+ self.gdb.b("main")
+ self.gdb.c()
+
self.gdb.hbreak("rot13")
# The breakpoint should be hit exactly 2 times.
for _ in range(2):
assertEqual(self.gdb.p("$a0"), self.gdb.p("&data"))
class TriggerDmode(TriggerTest):
+ def early_applicable(self):
+ return self.target.honors_tdata1_hmode
+
def check_triggers(self, tdata1_lsbs, tdata2):
dmode = 1 << (self.target.xlen-5)
# initialize stack pointer
la sp, stack_top
+ # Clear all hardware triggers
+ li t0, ~0
+1:
+ addi t0, t0, 1
+ csrw CSR_TSELECT, t0
+ csrw CSR_TDATA1, zero
+ csrr t1, CSR_TSELECT
+ beq t0, t1, 1b
+
# perform the rest of initialization in C
j _init
# before starting the test.
gdb_setup = []
+ # Implements dmode in tdata1 as described in the spec. Targets that need
+ # this value set to False are not compliant with the spec (but still usable
+ # as long as running code doesn't try to mess with triggers set by an
+ # external debugger).
+ honors_tdata1_hmode = True
+
# Internal variables:
directory = None
temporary_files = []