diff options
author | Ben Mudd <Ben.Mudd@sony.com> | 2023-01-19 15:05:04 +0000 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2023-01-19 15:11:26 +0000 |
commit | 03c45f14bf639c7d2346b956cd1ec61a669236e0 (patch) | |
tree | cb6cb7105619e956b9850a47d7baaff455a6b3d5 /cross-project-tests | |
parent | adcc90aefeabee3bd659520c754bd86db6e1d389 (diff) | |
download | llvm-03c45f14bf639c7d2346b956cd1ec61a669236e0.zip llvm-03c45f14bf639c7d2346b956cd1ec61a669236e0.tar.gz llvm-03c45f14bf639c7d2346b956cd1ec61a669236e0.tar.bz2 |
[Dexter] Add on_line parameter to DexExpectStepOrder command
DexExpectStepOrder uses the line to expect a debugger step from the actual line
of the command in the Dexter source file. Now Dexter scripts have mainly moved
to thier own script files instead of the actual source, there should be a
option to override this behaviour to choose your own debugger step location.
Reviewed By: Orlando
Differential Revision: https://reviews.llvm.org/D142099
Diffstat (limited to 'cross-project-tests')
5 files changed, 29 insertions, 9 deletions
diff --git a/cross-project-tests/debuginfo-tests/dexter/Commands.md b/cross-project-tests/debuginfo-tests/dexter/Commands.md index d5bd999..a98261a 100644 --- a/cross-project-tests/debuginfo-tests/dexter/Commands.md +++ b/cross-project-tests/debuginfo-tests/dexter/Commands.md @@ -101,13 +101,16 @@ frame.</br> --- ## 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 index 700dc54..d5cfc3c 100644 --- 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 @@ class DexExpectStepOrder(CommandBase): 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 @@ class DexExpectStepOrder(CommandBase): 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 index 014f15d..8044f39 100644 --- 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 @@ def in_source_file(source_files, step_info): 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 index 1582e7b..52ba7e1 100644 --- 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 @@ class Heuristic(object): 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 index cbcb506..c6e992d 100644 --- 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); |