1# DExTer : Debugging Experience Tester 2# ~~~~~~ ~ ~~ ~ ~~ 3# 4# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5# See https://llvm.org/LICENSE.txt for license information. 6# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7"""Abstract Base class for controlling debuggers.""" 8 9import abc 10 11class DebuggerControllerBase(object, metaclass=abc.ABCMeta): 12 @abc.abstractclassmethod 13 def _run_debugger_custom(self): 14 """Specify your own implementation of run_debugger_custom in your own 15 controller. 16 """ 17 pass 18 19 def run_debugger(self, debugger): 20 """Responsible for correctly launching and tearing down the debugger. 21 """ 22 self.debugger = debugger 23 with self.debugger: 24 if not self.debugger.loading_error: 25 self._run_debugger_custom() 26 27 # We may need to pickle this debugger controller after running the 28 # debugger. Debuggers are not picklable objects, so set to None. 29 self.debugger = None 30