diff --git a/cross-project-tests/debuginfo-tests/dexter/Commands.md b/cross-project-tests/debuginfo-tests/dexter/Commands.md --- a/cross-project-tests/debuginfo-tests/dexter/Commands.md +++ b/cross-project-tests/debuginfo-tests/dexter/Commands.md @@ -101,13 +101,16 @@ --- ## DexExpectStepOrder - DexExpectStepOrder(*order) + DexExpectStepOrder(*order [,**on_line]) Arg list: order (int): One or more indices. + Keyword args: + on_line (int): Expect this line to be stepped on in the order given. + ### Description -Expect the line every `DexExpectStepOrder` is found on to be stepped on in +Expect the line every `DexExpectStepOrder` is found on, or given from `on_line`, to be stepped on in `order`. Each instance must have a set of unique ascending indices. ### Heuristic diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectStepOrder.py b/cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectStepOrder.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectStepOrder.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectStepOrder.py @@ -18,10 +18,16 @@ See Commands.md for more info. """ - def __init__(self, *args): + def __init__(self, *args, **kwargs): if not args: raise TypeError('Need at least one order number') + if 'on_line' in kwargs: + try: + on_line = kwargs.pop('on_line') + self.on_line = int(on_line) + except ValueError: + raise ValueError('on_line value \'{0}\' cannot be parsed to an integer'.format(on_line)) self.sequence = [int(x) for x in args] super(DexExpectStepOrder, self).__init__() @@ -29,6 +35,9 @@ def get_name(): return __class__.__name__ + def get_line(self): + return self.on_line if hasattr(self, 'on_line') else self.lineno + def eval(self, step_info): return {'DexExpectStepOrder': ValueIR(expression=str(step_info.current_location.lineno), value=str(step_info.step_index), type_name=None, diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py @@ -19,8 +19,8 @@ for f in source_files) def have_hit_line(watch, loc): - if hasattr(watch, '_on_line'): - return watch._on_line == loc.lineno + if hasattr(watch, 'on_line'): + return watch.on_line == loc.lineno elif hasattr(watch, '_from_line'): return watch._from_line <= loc.lineno and watch._to_line >= loc.lineno elif watch.lineno == loc.lineno: diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/heuristic/Heuristic.py b/cross-project-tests/debuginfo-tests/dexter/dex/heuristic/Heuristic.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/heuristic/Heuristic.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/heuristic/Heuristic.py @@ -253,7 +253,7 @@ cmds = steps.commands['DexExpectStepOrder'] # Form a list of which line/cmd we _should_ have seen - cmd_num_lst = [(x, c.lineno) for c in cmds + cmd_num_lst = [(x, c.get_line()) for c in cmds for x in c.sequence] # Order them by the sequence number cmd_num_lst.sort(key=lambda t: t[0]) diff --git a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_order.cpp b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_order.cpp --- a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_order.cpp +++ b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_order.cpp @@ -9,8 +9,16 @@ int main() { - volatile int x = 1; // DexExpectStepOrder(1) - volatile int y = 1; // DexExpectStepOrder(2) - volatile int z = 1; // DexExpectStepOrder(3) + volatile int a = 1; // DexExpectStepOrder(1) + volatile int b = 1; // DexExpectStepOrder(2) + volatile int c = 1; // DexExpectStepOrder(3) + + volatile int x = 1; + volatile int y = 1; + volatile int z = 1; return 0; } + +// DexExpectStepOrder(4, on_line=16); +// DexExpectStepOrder(5, on_line=17); +// DexExpectStepOrder(6, on_line=18);