1 // Purpose:
2 //      Check that \DexExpectStepKind correctly counts 'VERTICAL_BACKWARD' steps
3 //      for a trivial test. Expect one 'VERTICAL_BACKWARD' for every step onto
4 //      a lesser source line number in the same function. Expect one
5 //      'VERTICAL_FORWARD' for every step onto a greater source line number in
6 //      the same function.
7 //
8 // UNSUPPORTED: system-darwin
9 //
10 // TODO: The dbgeng debugger does not support column step reporting at present.
11 // XFAIL: system-windows
12 //
13 // RUN: %dexter_regression_test -- %s | FileCheck %s
14 // CHECK: direction.cpp:
15 
func(int i)16 int func(int i) {
17     return i; // step 7, 9, 11
18 }
19 
main()20 int main()
21 {
22     for (int i = 0; i < 2; ++i) { // step 1: FUNC, step 3, 5: VERTICAL_BACKWARD
23         i = i;                    // step 2, 4: VERTICAL_FORWARD
24     }
25     // ---------1           - step 6: VERTICAL_FORWARD
26     // ---------|---------2 - step 8: HORIZONTAL_FORWARD
27     // ----3----|---------| - step 10: HORIZONTAL_BACKWARD
28     return func(func(0) + func(1));
29 }
30 
31 // DexExpectStepKind('VERTICAL_BACKWARD', 2)
32 // DexExpectStepKind('VERTICAL_FORWARD', 3)
33 // DexExpectStepKind('HORIZONTAL_FORWARD', 1)
34 // DexExpectStepKind('HORIZONTAL_BACKWARD', 1)
35