[llvm-branch-commits] [llvm] [Dexter] Add additional variable metrics, sanitize lldb-dap function names (PR #204366)
Stephen Tozer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 17 08:25:33 PDT 2026
https://github.com/SLTozer updated https://github.com/llvm/llvm-project/pull/204366
>From 7adfd7c4f7bea1452b3cd96e78f703720ad8bf6d Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Wed, 17 Jun 2026 13:46:31 +0100
Subject: [PATCH 1/3] backport: add optimized out metric
---
.../debuginfo-tests/dexter/dex/evaluation/Metrics.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py b/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py
index 28df661bb1b24..d42a56c6bf351 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py
@@ -107,6 +107,7 @@ def get_variable_metrics(
all_expected_values = get_expected_value_set(expected_values)
seen_expected_values = set()
num_correct_steps = 0
+ num_optimized_out_steps = 0
num_missing_var_steps = 0
num_unexpected_value_steps = 0
partial_step_correctness = 0.0
@@ -118,7 +119,10 @@ def get_variable_metrics(
if match.match_result == MatchResult.TRUE:
num_correct_steps += 1
elif match.actual_result is None:
- num_missing_var_steps += 1
+ if match.actual and match.actual.is_optimized_away:
+ num_optimized_out_steps += 1
+ else:
+ num_missing_var_steps += 1
else:
num_unexpected_value_steps += 1
assert all(
@@ -143,6 +147,8 @@ def get_variable_metrics(
),
# The sum of the 0.0-1.0 "correctness value" of matches across each step.
"partial_step_correctness": ScalarMetric(partial_step_correctness),
+ # The number of steps where the watched variable/expression was marked "optimized out" in the debugger.
+ "optimized_out_steps": ScalarMetric(num_optimized_out_steps, improves_asc=False),
# The number of steps where the watched variable/expression was not available in the debugger.
"missing_var_steps": ScalarMetric(num_missing_var_steps, improves_asc=False),
# The number of steps where the watched variable/expression had a value not in the set of expected values.
>From 44198f0151d7c162ad82bb191ff1463024ec8b49 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Wed, 17 Jun 2026 15:48:56 +0100
Subject: [PATCH 2/3] Fix: Account for weird function name endings in lldb-dap
---
.../debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py
index 6ab06d066dfe6..6383036a8e1f1 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py
@@ -436,6 +436,11 @@ def frames_below_main(self):
"_start",
]
+ def _sanitize_function_name(self, name: str): # pylint: disable=no-self-use
+ if name.endswith(" [opt]"):
+ name = name[:-len(" [opt]")]
+ return name
+
def _post_step_hook(self):
"""Hook to be executed after completing a step request."""
if self._debugger_state.stopped_reason == "step":
>From 9a22cc0e649f22f85509c783316e665f9d6bee8e Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Wed, 17 Jun 2026 15:49:30 +0100
Subject: [PATCH 3/3] Add irretrievable metric
---
.../debuginfo-tests/dexter/dex/evaluation/Metrics.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py b/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py
index d42a56c6bf351..2b933354a4e1a 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/evaluation/Metrics.py
@@ -108,6 +108,7 @@ def get_variable_metrics(
seen_expected_values = set()
num_correct_steps = 0
num_optimized_out_steps = 0
+ num_irretrievable_steps = 0
num_missing_var_steps = 0
num_unexpected_value_steps = 0
partial_step_correctness = 0.0
@@ -121,6 +122,8 @@ def get_variable_metrics(
elif match.actual_result is None:
if match.actual and match.actual.is_optimized_away:
num_optimized_out_steps += 1
+ elif match.actual and match.actual.is_irretrievable:
+ num_irretrievable_steps += 1
else:
num_missing_var_steps += 1
else:
@@ -149,6 +152,8 @@ def get_variable_metrics(
"partial_step_correctness": ScalarMetric(partial_step_correctness),
# The number of steps where the watched variable/expression was marked "optimized out" in the debugger.
"optimized_out_steps": ScalarMetric(num_optimized_out_steps, improves_asc=False),
+ # The number of steps where the watched variable/expression had an inaccessible address in the debugger.
+ "irretrievable_steps": ScalarMetric(num_irretrievable_steps, improves_asc=False),
# The number of steps where the watched variable/expression was not available in the debugger.
"missing_var_steps": ScalarMetric(num_missing_var_steps, improves_asc=False),
# The number of steps where the watched variable/expression had a value not in the set of expected values.
More information about the llvm-branch-commits
mailing list