56 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 8from dex.command.CommandBase import CommandBase9from dex.dextIR import LocIR10from dex.dextIR import ValueIR11 12 13class DexExpectStepOrder(CommandBase):14 """Expect the line every `DexExpectStepOrder` is found on to be stepped on15 in `order`. Each instance must have a set of unique ascending indices.16 17 DexExpectStepOrder(*order)18 19 See Commands.md for more info.20 """21 22 def __init__(self, *args, **kwargs):23 if not args:24 raise TypeError("Need at least one order number")25 26 if "on_line" in kwargs:27 try:28 on_line = kwargs.pop("on_line")29 self.on_line = int(on_line)30 except ValueError:31 raise ValueError(32 "on_line value '{0}' cannot be parsed to an integer".format(on_line)33 )34 self.sequence = [int(x) for x in args]35 super(DexExpectStepOrder, self).__init__()36 37 @staticmethod38 def get_name():39 return __class__.__name__40 41 def get_line(self):42 return self.on_line if hasattr(self, "on_line") else self.lineno43 44 def eval(self, step_info):45 return {46 "DexExpectStepOrder": ValueIR(47 expression=str(step_info.current_location.lineno),48 value=str(step_info.step_index),49 type_name=None,50 error_string=None,51 could_evaluate=True,52 is_optimized_away=True,53 is_irretrievable=False,54 )55 }56