| 1 |
// Purpose: |
| 2 |
// Test \DexStepFunction usage with \DexContinue. Continuing out of `c` |
| 3 |
// should result in stepping resuming in `a` (check there's no issue when |
| 4 |
// `b` is inlined). Then continuing out of `a` should run on to `f` where |
| 5 |
// stepping resumes again. Stepping out of `f` into `main`, run free |
| 6 |
// again until the program exits. |
| 7 |
// |
| 8 |
// This command is only implemented for debuggers with DAP support. |
| 9 |
// UNSUPPORTED: system-windows |
| 10 |
// |
| 11 |
// RUN: %dexter_regression_test_cxx_build %s -o %t |
| 12 |
// RUN: %dexter_regression_test_run -v --binary %t -- %s 2>&1 | FileCheck %s |
| 13 |
|
| 14 |
int g = 0; |
| 15 |
int c(int) { |
| 16 |
++g; |
| 17 |
++g; |
| 18 |
++g; |
| 19 |
++g; |
| 20 |
++g; |
| 21 |
return 0; |
| 22 |
} |
| 23 |
|
| 24 |
__attribute__((always_inline)) |
| 25 |
int b(int) { |
| 26 |
++g; |
| 27 |
return c(g); |
| 28 |
} |
| 29 |
|
| 30 |
int a(int) { |
| 31 |
++g; |
| 32 |
b(g); |
| 33 |
++g; |
| 34 |
return g; |
| 35 |
} |
| 36 |
|
| 37 |
void f() { |
| 38 |
++g; |
| 39 |
} |
| 40 |
|
| 41 |
int main() { |
| 42 |
int x = a(g); |
| 43 |
f(); |
| 44 |
return x; |
| 45 |
} |
| 46 |
|
| 47 |
// DexStepFunction('c') |
| 48 |
// DexContinue(from_line=17, to_line=19) |
| 49 |
// DexContinue(from_line=20) |
| 50 |
// DexStepFunction('a') |
| 51 |
// DexContinue(from_line=33) |
| 52 |
// DexStepFunction('f') |
| 53 |
|
| 54 |
// CHECK: ## BEGIN ## |
| 55 |
// CHECK-NEXT: . [0, "a(int)", "{{.*}}dex-continue.cpp", 31, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []] |
| 56 |
// CHECK-NEXT: . [1, "a(int)", "{{.*}}dex-continue.cpp", 32, 5, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []] |
| 57 |
// CHECK-NEXT: . . . [2, "c(int)", "{{.*}}dex-continue.cpp", 16, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []] |
| 58 |
// CHECK-NEXT: . . . [3, "c(int)", "{{.*}}dex-continue.cpp", 17, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []] |
| 59 |
// CHECK-NEXT: . . . [4, "c(int)", "{{.*}}dex-continue.cpp", 19, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []] |
| 60 |
// CHECK-NEXT: . . . [5, "c(int)", "{{.*}}dex-continue.cpp", 20, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []] |
| 61 |
// CHECK-NEXT: . [6, "a(int)", "{{.*}}dex-continue.cpp", 33, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []] |
| 62 |
// CHECK-NEXT: . [7, "f()", "{{.*}}dex-continue.cpp", 38, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []] |
| 63 |
// CHECK-NEXT: . [8, "f()", "{{.*}}dex-continue.cpp", 39, 1, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []] |
| 64 |
// CHECK-NEXT: ## END (9 steps) ## |