| 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 |
"""A Command that enables test writers to specify a limited number of break |
| 8 |
points using an start condition and range. |
| 9 |
""" |
| 10 |
|
| 11 |
from dex.command.CommandBase import CommandBase |
| 12 |
|
| 13 |
|
| 14 |
class DexLimitSteps(CommandBase): |
| 15 |
def __init__(self, *args, **kwargs): |
| 16 |
if len(args) == 0: |
| 17 |
self.expression = None |
| 18 |
self.values = [] |
| 19 |
elif len(args) == 1: |
| 20 |
raise TypeError("expected 0 or at least 2 positional arguments") |
| 21 |
else: |
| 22 |
self.expression = args[0] |
| 23 |
self.values = [str(arg) for arg in args[1:]] |
| 24 |
try: |
| 25 |
on_line = kwargs.pop("on_line") |
| 26 |
self.from_line = on_line |
| 27 |
self.to_line = on_line |
| 28 |
except KeyError: |
| 29 |
self.from_line = kwargs.pop("from_line", 1) |
| 30 |
self.to_line = kwargs.pop("to_line", 999999) |
| 31 |
self.hit_count = kwargs.pop("hit_count", None) |
| 32 |
if kwargs: |
| 33 |
raise TypeError("unexpected named args: {}".format(", ".join(kwargs))) |
| 34 |
super(DexLimitSteps, self).__init__() |
| 35 |
|
| 36 |
def eval(self): |
| 37 |
raise NotImplementedError("DexLimitSteps commands cannot be evaled.") |
| 38 |
|
| 39 |
@staticmethod |
| 40 |
def get_name(): |
| 41 |
return __class__.__name__ |
| 42 |
|
| 43 |
@staticmethod |
| 44 |
def get_subcommands() -> dict: |
| 45 |
return None |