Mate Toth-Pal | a8797e1 | 2020-06-05 21:14:26 +0200 | [diff] [blame] | 1 | #-------------------------------------------------------------------------------
|
| 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 |
|
| 11 | import logging
|
| 12 | from irq_test_abstract_debugger import AbstractDebugger
|
| 13 |
|
| 14 | class 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
|