Skip to content

[Dexter] Implement DexStepFunction and DexContinue #152721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: users/OCHyams/dex-skeletons
Choose a base branch
from

Conversation

OCHyams
Copy link
Contributor

@OCHyams OCHyams commented Aug 8, 2025

Adding together in a single commit as their implementations are linked.

Only supported for DAP debuggers. These two commands make it a bit easier to
drive dexter: DexStepFunction tells dexter to step-next though a function and
DexContinue tells dexter to continue (run free) from one breakpoint to another
within the current DexStepFunction function.

When the DexStepFunction function breakpoint is triggered, dexter sets an
instruction breakpoint at the return-address. This is so that stepping can
resume in any other DexStepFunctions deeps in the call stack.

Copy link
Contributor Author

OCHyams commented Aug 8, 2025

Copy link

github-actions bot commented Aug 8, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex-continue.cpp cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex_step_function.cpp
View the diff from clang-format here.
diff --git a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex-continue.cpp b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex-continue.cpp
index bb51b85cb..0e9c36c22 100644
--- a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex-continue.cpp
+++ b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex-continue.cpp
@@ -21,8 +21,7 @@ int c(int) {
   return 0;
 }
 
-__attribute__((always_inline))
-int b(int) {
+__attribute__((always_inline)) int b(int) {
   ++g;
   return c(g);
 }
@@ -34,9 +33,7 @@ int a(int) {
   return g;
 }
 
-void f() {
-  ++g;
-}
+void f() { ++g; }
 
 int main() {
   int x = a(g);
@@ -52,13 +49,20 @@ int main() {
 // DexStepFunction('f')
 
 // CHECK:      ## BEGIN ##
-// CHECK-NEXT: .   [0, "a(int)", "{{.*}}dex-continue.cpp", 31, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
-// CHECK-NEXT: .   [1, "a(int)", "{{.*}}dex-continue.cpp", 32, 5, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: .   .   .   [2, "c(int)", "{{.*}}dex-continue.cpp", 16, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
-// CHECK-NEXT: .   .   .   [3, "c(int)", "{{.*}}dex-continue.cpp", 17, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: .   .   .   [4, "c(int)", "{{.*}}dex-continue.cpp", 19, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: .   .   .   [5, "c(int)", "{{.*}}dex-continue.cpp", 20, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: .   [6, "a(int)", "{{.*}}dex-continue.cpp", 33, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: .   [8, "f()", "{{.*}}dex-continue.cpp", 38, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: .   [9, "f()", "{{.*}}dex-continue.cpp", 39, 1, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT: ## END (9 steps) ##
+// CHECK-NEXT: .   [0, "a(int)", "{{.*}}dex-continue.cpp", 31, 3,
+// "StopReason.BREAKPOINT", "StepKind.FUNC", []] CHECK-NEXT: .   [1, "a(int)",
+// "{{.*}}dex-continue.cpp", 32, 5, "StopReason.STEP",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: .   .   .   [2, "c(int)",
+// "{{.*}}dex-continue.cpp", 16, 3, "StopReason.BREAKPOINT", "StepKind.FUNC",
+// []] CHECK-NEXT: .   .   .   [3, "c(int)", "{{.*}}dex-continue.cpp", 17, 3,
+// "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: .   .
+// .   [4, "c(int)", "{{.*}}dex-continue.cpp", 19, 3, "StopReason.BREAKPOINT",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: .   .   .   [5, "c(int)",
+// "{{.*}}dex-continue.cpp", 20, 3, "StopReason.BREAKPOINT",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: .   [6, "a(int)",
+// "{{.*}}dex-continue.cpp", 33, 3, "StopReason.BREAKPOINT",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: .   [8, "f()",
+// "{{.*}}dex-continue.cpp", 38, 3, "StopReason.BREAKPOINT",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: .   [9, "f()",
+// "{{.*}}dex-continue.cpp", 39, 1, "StopReason.STEP",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT: ## END (9 steps) ##
diff --git a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex_step_function.cpp b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex_step_function.cpp
index e7e666d0e..4aaabb47f 100644
--- a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex_step_function.cpp
+++ b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex_step_function.cpp
@@ -23,17 +23,19 @@ int a(int) {
   return b(g);
 }
 
-int main() {
-  return a(g);
-}
+int main() { return a(g); }
 
 // DexStepFunction('a')
 // DexStepFunction('c')
 
 // CHECK:      ## BEGIN ##
-// CHECK-NEXT:.   [0, "a(int)", "{{.*}}dex_step_function.cpp", 22, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
-// CHECK-NEXT:.   [1, "a(int)", "{{.*}}dex_step_function.cpp", 23, 12, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT:.   .   .   [2, "c(int)", "{{.*}}dex_step_function.cpp", 12, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
-// CHECK-NEXT:.   .   .   [3, "c(int)", "{{.*}}dex_step_function.cpp", 13, 3, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []]
-// CHECK-NEXT:.   [6, "a(int)", "{{.*}}dex_step_function.cpp", 23, 3, "StopReason.STEP", "StepKind.HORIZONTAL_BACKWARD", []]
-// CHECK-NEXT: ## END (5 steps) ##
+// CHECK-NEXT:.   [0, "a(int)", "{{.*}}dex_step_function.cpp", 22, 3,
+// "StopReason.BREAKPOINT", "StepKind.FUNC", []] CHECK-NEXT:.   [1, "a(int)",
+// "{{.*}}dex_step_function.cpp", 23, 12, "StopReason.STEP",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT:.   .   .   [2, "c(int)",
+// "{{.*}}dex_step_function.cpp", 12, 3, "StopReason.BREAKPOINT",
+// "StepKind.FUNC", []] CHECK-NEXT:.   .   .   [3, "c(int)",
+// "{{.*}}dex_step_function.cpp", 13, 3, "StopReason.STEP",
+// "StepKind.VERTICAL_FORWARD", []] CHECK-NEXT:.   [6, "a(int)",
+// "{{.*}}dex_step_function.cpp", 23, 3, "StopReason.STEP",
+// "StepKind.HORIZONTAL_BACKWARD", []] CHECK-NEXT: ## END (5 steps) ##

Copy link

github-actions bot commented Aug 8, 2025

✅ With the latest revision this PR passed the Python code formatter.

@OCHyams OCHyams marked this pull request as ready for review August 8, 2025 13:38
@OCHyams OCHyams requested a review from SLTozer August 8, 2025 13:38
@OCHyams OCHyams force-pushed the users/OCHyams/dex-skeletons branch from f42e8d1 to 3c16976 Compare August 12, 2025 11:14
Adding together in a single commit as their implementations are linked.

Only supported for DAP debuggers. These two commands make it a bit easier to
drive dexter: DexStepFunction tells dexter to step-next though a function and
DexContinue tells dexter to continue (run free) from one breakpoint to another
within the current DexStepFunction function.

When the DexStepFunction function breakpoint is triggered, dexter sets an
instruction breakpoint at the return-address. This is so that stepping can
resume in any other DexStepFunctions deeps in the call stack.
@OCHyams OCHyams force-pushed the users/OCHyams/dex-new-cmds-impl branch from 18b6dc8 to 07cee24 Compare August 12, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant