Skip to content

Commit 1a8fa55

Browse files
committed
Auto merge of #161574 - Walnut356:linux_lldb, r=jieyouxu
Enable `tests/debuginfo` on `test-aarch64-gnu-llvm-21` This should allow `tests/debuginfo` to run the LLDB tests in PR CI. This should run `basic-types` and `pretty-std` which both contain `repr` directives. r? @jieyouxu @Kobzol
2 parents a92214c + e12a74e commit 1a8fa55

4 files changed

Lines changed: 33 additions & 14 deletions

File tree

‎src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-21/Dockerfile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1717
gdb \
1818
llvm-21-tools \
1919
llvm-21-dev \
20+
lldb-21 \
21+
python3-lldb-21 \
2022
libedit-dev \
2123
libssl-dev \
2224
pkg-config \
@@ -40,6 +42,9 @@ RUN sh /scripts/sccache.sh
4042
ENV NO_DOWNLOAD_CI_LLVM="1"
4143
ENV EXTERNAL_LLVM="1"
4244

45+
# Override the default debugger `discover` behavior
46+
ENV LLDB_PATH="lldb-21"
47+
4348
# Using llvm-link-shared due to libffi issues -- see #34486
4449
ENV RUST_CONFIGURE_ARGS="--build=aarch64-unknown-linux-gnu \
4550
--llvm-root=/usr/lib/llvm-21 \

‎src/ci/run.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ else
143143
# Enable GDB/LLDB automatic discovery on CI
144144
# Ideally, we should later change this to provide the paths explicitly
145145
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.gdb=discover"
146-
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.lldb=discover"
146+
if [ -n "$LLDB_PATH" ]; then
147+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.lldb=$LLDB_PATH"
148+
else
149+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.lldb=discover"
150+
fi
147151

148152
# We almost always want debug assertions enabled, but sometimes this takes too
149153
# long for too little benefit, so we just turn them off.

‎src/etc/debugger_tester/common.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ def print_field_errors(self, expected: "Type", error_source: str):
319319
elif types_match and names_match:
320320
reordered = "\n ".join(
321321
(
322-
f"{m[1].name} offset: +{m[1].offset} -> {m[0].name} offset: \n\
323-
+{m[0].offset}"
322+
f"{m[1].name} offset: +{m[1].offset} -> {m[0].name} offset: +{m[0].offset}"
324323
)
325324
for m in mismatches
326325
)

‎src/etc/debugger_tester/lldb/check_lldb.py‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,24 +207,30 @@ def var_matches(var: Variable, expected: Variable, valobj: lldb.SBValue) -> Resu
207207

208208
type_ok = var.type == expected.type
209209

210+
all_providers_ok = (
211+
summary_ok & synthetic_ok & format_ok & pretty_type_name_ok & pretty_print_ok
212+
)
213+
210214
if var.has_visualizer() or expected.has_visualizer():
211215
type_match_ok = type_matches(
212-
valobj.GetType(),
213-
valobj.GetTarget(),
214-
summary_ok
215-
& synthetic_ok
216-
& format_ok
217-
& pretty_type_name_ok
218-
& pretty_print_ok,
216+
valobj.GetType(), valobj.GetTarget(), all_providers_ok
219217
)
220218
else:
221219
type_match_ok = Result.Ok
222220

221+
# (small hack) If the type information doesn't match, BUT it doesn't affect the synthetics, we
222+
# don't actually care that much. This prevents CI from failing when 2 different targets use 2
223+
# different layouts, e.g.::
224+
# x86_64-linux-gnu: `Vec { buf, len, marker}`
225+
# aarch64-linux-gnu: `Vec {len, buf, marker}`
226+
if type_match_ok == Result.Mismatch and all_providers_ok:
227+
type_match_ok = Result.Ok
228+
223229
value_ok = var.value == expected.value
224230

225231
work_list = [valobj.GetChildAtIndex(i) for i in range(valobj.GetNumChildren())]
226232
target = valobj.GetTarget()
227-
child_types_ok = True
233+
child_types_ok = Result.Ok
228234

229235
while len(work_list) != 0:
230236
obj = work_list.pop()
@@ -237,12 +243,17 @@ def var_matches(var: Variable, expected: Variable, valobj: lldb.SBValue) -> Resu
237243
if child.IsValid():
238244
work_list.append(child)
239245
else:
240-
child_types_ok = False
246+
child_types_ok = Result.Mismatch
241247

242248
if var.has_visualizer() or expected.has_visualizer():
243-
child_types_ok &= type_matches(obj.GetType(), target) == Result.Ok
249+
child_types_ok &= type_matches(obj.GetType(), target)
250+
251+
# similar to type matching, we don't actually care if there's a mismatch if the
252+
# providers aren't affected.
253+
if child_types_ok == Result.Mismatch and all_providers_ok:
254+
child_types_ok = Result.Ok
244255
else:
245-
type_match_ok = Result.Ok
256+
child_types_ok = Result.Ok
246257

247258
children_ok = children_match(
248259
var.children, expected.children, valobj.GetName(), valobj

0 commit comments

Comments
 (0)