[llvm] [Dexter] Only increment step index if we record the step (PR #156832)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 01:56:24 PDT 2025


https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/156832

Should fix the issue raised here - https://github.com/llvm/llvm-project/pull/156481#issuecomment-3251158052 

Prior to this patch we incremented step_index every time the debugger stopped. Now that some stops are not recorded, we should only increment the step_index for those that are.

This should make the `-v` output more consistent between platforms and debuggers.

>From 17f32836fff66230511f69f452ac542843d71501 Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Thu, 4 Sep 2025 09:53:04 +0100
Subject: [PATCH] [Dexter] Only incremement step index if we record the step

---
 .../dex/debugger/DebuggerControllers/ConditionalController.py | 2 +-
 .../dexter/feature_tests/commands/control/dex-continue.cpp    | 4 ++--
 .../feature_tests/commands/control/dex_step_function.cpp      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
index 7ce374184c525..f84c4fd153c78 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py
@@ -268,7 +268,6 @@ def _run_debugger_custom(self, cmdline):
             step_info = self.debugger.get_step_info(self._watches, self._step_index)
             backtrace = None
             if step_info.current_frame:
-                self._step_index += 1
                 backtrace = [f.function for f in step_info.frames]
 
             record_step = False
@@ -369,6 +368,7 @@ def _run_debugger_custom(self, cmdline):
                         step_function_backtraces.pop()
 
             if record_step and step_info.current_frame:
+                self._step_index += 1
                 # Record the step.
                 update_step_watches(
                     step_info, self._watches, self.step_collection.commands
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 bb51b85cbe992..2d5cbe04569d5 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
@@ -59,6 +59,6 @@ int main() {
 // 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: .   [7, "f()", "{{.*}}dex-continue.cpp", 38, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
+// CHECK-NEXT: .   [8, "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 e7e666d0e0dc4..900e10b64a96e 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
@@ -35,5 +35,5 @@ int main() {
 // 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:.   [4, "a(int)", "{{.*}}dex_step_function.cpp", 23, 3, "StopReason.STEP", "StepKind.HORIZONTAL_BACKWARD", []]
 // CHECK-NEXT: ## END (5 steps) ##



More information about the llvm-commits mailing list