blob: d31550a49a7e43c4c232017342e21e95abd45496 [file] [log] [blame]
Kevin Penga127b452021-02-23 10:02:55 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2020, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8""" This module contains a dummy implementation of the debugger control interface
9"""
10
11import logging
12from irq_test_abstract_debugger import AbstractDebugger
13
14class DummyDebugger(AbstractDebugger):
15 """A dummy implementation of the debugger control interface
16
17 This class can be used for rapidly testing the testcase execution algorithm.
18
19 Breakpoint names are put in a list to keep track of them. Interrupts are not
20 emulated in any way, the 'trigger_interrupt' function returns without doing
21 anything. 'continue_execution' returns immediately as well, and
22 'get_triggered_breakpoint' returns the breakpoint added the earliest.
23 """
24 def __init__(self, use_sw_breakpoints):
25 super(DummyDebugger, self).__init__()
26 self.breakpoints = []
27 self.use_sw_breakpoints = use_sw_breakpoints
28
29 def set_breakpoint(self, name, location):
30 if (self.use_sw_breakpoints):
31 breakpoint_type = "sw"
32 else:
33 breakpoint_type = "hw"
34 logging.info("debugger: set %s breakpoint %s", breakpoint_type, name)
35 self.breakpoints.append(name)
36
37 def trigger_interrupt(self, interrupt_line):
38 logging.info("debugger: triggering interrupt line for %s", str(interrupt_line))
39
40 def continue_execution(self):
41 logging.info("debugger: continue")
42
43 def clear_breakpoints(self):
44 logging.info("debugger: clearing breakpoints")
45 self.breakpoints = []
46
47 def get_triggered_breakpoint(self):
48 if self.breakpoints:
49 return self.breakpoints[0]
50 return None