brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 333b765 Raw
49 lines · python
1# DExTer : Debugging Experience Tester2# ~~~~~~   ~         ~~         ~   ~~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-exception7"""Command for specifying an expected number of steps of a particular kind."""8 9from dex.command.CommandBase import CommandBase10from dex.dextIR.StepIR import StepKind11 12 13class DexExpectStepKind(CommandBase):14    """Expect to see a particular step `kind` a number of `times` while stepping15    through the program.16 17    DexExpectStepKind(kind, times)18 19    See Commands.md for more info.20    """21 22    def __init__(self, *args):23        if len(args) != 2:24            raise TypeError("expected two args")25 26        try:27            step_kind = StepKind[args[0]]28        except KeyError:29            raise TypeError(30                "expected arg 0 to be one of {}".format(31                    [kind for kind, _ in StepKind.__members__.items()]32                )33            )34 35        self.name = step_kind36        self.count = args[1]37 38        super(DexExpectStepKind, self).__init__()39 40    @staticmethod41    def get_name():42        return __class__.__name__43 44    def eval(self):45        # DexExpectStepKind eval() implementation is mixed into46        # Heuristic.__init__()47        # [TODO] Fix this ^.48        pass49