From ff0619838c7a1cd149065ee9a60dfa0358464107 Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Mon, 27 Apr 2026 04:46:24 -0500 Subject: [PATCH 1/2] replace `lldb_commands` with `__lldb_init_module` --- src/bootstrap/src/core/build_steps/dist.rs | 1 - src/etc/lldb_commands | 86 ----- src/etc/lldb_lookup.py | 363 +++++++++++++++++- src/etc/lldb_providers.py | 64 ++- src/etc/rust-lldb | 3 +- .../compiletest/src/runtest/debuginfo.rs | 6 +- 6 files changed, 386 insertions(+), 137 deletions(-) delete mode 100644 src/etc/lldb_commands diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 222b982073280..46f594e413b3a 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -760,7 +760,6 @@ impl Step for DebuggerScripts { cp_debugger_script("lldb_lookup.py"); cp_debugger_script("lldb_providers.py"); - cp_debugger_script("lldb_commands") } } diff --git a/src/etc/lldb_commands b/src/etc/lldb_commands deleted file mode 100644 index 6db81ce9be4df..0000000000000 --- a/src/etc/lldb_commands +++ /dev/null @@ -1,86 +0,0 @@ -# LLDB iterates through these in reverse order to discover summaries/synthetics that means the top -# of the list can be "overwritten" by items lower on the list. Be careful when reordering items. - -# Forces test-compliant formatting to all other types -type synthetic add -l lldb_lookup.synthetic_lookup -x ".*" --category Rust -# Std String -type synthetic add -l lldb_lookup.StdStringSyntheticProvider -x "^(alloc::([a-z_]+::)+)String$" --category Rust -type summary add -F lldb_lookup.StdStringSummaryProvider -e -x -h "^(alloc::([a-z_]+::)+)String$" --category Rust - -# Std str -type synthetic add -l lldb_lookup.StdSliceSyntheticProvider -x "^&(mut )?str$" --category Rust -type summary add -F lldb_lookup.StdStrSummaryProvider -e -x -h "^&(mut )?str$" --category Rust - -## MSVC -type synthetic add -l lldb_lookup.MSVCStrSyntheticProvider -x "^ref(_mut)?\$$" --category Rust -type summary add -F lldb_lookup.StdStrSummaryProvider -e -h -x "^ref(_mut)?\$$" --category Rust - -# Array/Slice -type synthetic add -l lldb_lookup.StdSliceSyntheticProvider -x "^&(mut )?\\[.+\\]$" --category Rust -type summary add -F lldb_lookup.SizeSummaryProvider -e -x -h "^&(mut )?\\[.+\\]$" --category Rust - -## MSVC -type synthetic add -l lldb_lookup.MSVCStdSliceSyntheticProvider -x "^ref(_mut)?\$ >" --category Rust -type summary add -F lldb_lookup.StdSliceSummaryProvider -e -x -h "^ref(_mut)?\$ >" --category Rust - -# OsString -type summary add -F lldb_lookup.StdOsStringSummaryProvider -e -x -h "^(std::ffi::([a-z_]+::)+)OsString$" --category Rust - -# Vec -type synthetic add -l lldb_lookup.StdVecSyntheticProvider -x "^(alloc::([a-z_]+::)+)Vec<.+>$" --category Rust -type summary add -F lldb_lookup.SizeSummaryProvider -e -x -h "^(alloc::([a-z_]+::)+)Vec<.+>$" --category Rust - -# VecDeque -type synthetic add -l lldb_lookup.StdVecDequeSyntheticProvider -x "^(alloc::([a-z_]+::)+)VecDeque<.+>$" --category Rust -type summary add -F lldb_lookup.SizeSummaryProvider -e -x -h "^(alloc::([a-z_]+::)+)VecDeque<.+>$" --category Rust - -# HashMap -type synthetic add -l lldb_lookup.classify_hashmap -x "^(std::collections::([a-z_]+::)+)HashMap<.+>$" --category Rust -type summary add -F lldb_lookup.SizeSummaryProvider -e -x -h "^(std::collections::([a-z_]+::)+)HashMap<.+>$" --category Rust - -# HashSet -type synthetic add -l lldb_lookup.classify_hashset -x "^(std::collections::([a-z_]+::)+)HashSet<.+>$" --category Rust -type summary add -F lldb_lookup.SizeSummaryProvider -e -x -h "^(std::collections::([a-z_]+::)+)HashSet<.+>$" --category Rust - -# Rc -type synthetic add -l lldb_lookup.StdRcSyntheticProvider -x "^(alloc::([a-z_]+::)+)Rc<.+>$" --category Rust -type summary add -F lldb_lookup.StdRcSummaryProvider -e -x -h "^(alloc::([a-z_]+::)+)Rc<.+>$" --category Rust - -# Arc -type synthetic add -l lldb_lookup.arc_synthetic -x "^(alloc::([a-z_]+::)+)Arc<.+>$" --category Rust -type summary add -F lldb_lookup.StdRcSummaryProvider -e -x -h "^(alloc::([a-z_]+::)+)Arc<.+>$" --category Rust - -# Cell -type synthetic add -l lldb_lookup.StdCellSyntheticProvider -x "^(core::([a-z_]+::)+)Cell<.+>$" --category Rust - -# RefCell -type synthetic add -l lldb_lookup.StdRefSyntheticProvider -x "^(core::([a-z_]+::)+)Ref(Cell|Mut)?<.+>$" --category Rust -type summary add -F lldb_lookup.StdRefSummaryProvider -e -x -h "^(core::([a-z_]+::)+)Ref(Cell|Mut)?<.+>$" --category Rust - -# NonZero -type summary add -F lldb_lookup.StdNonZeroNumberSummaryProvider -e -x -h "^(core::([a-z_]+::)+)NonZero(<.+>|I\d{0,3}|U\d{0,3})$" --category Rust - -# PathBuf -type summary add -F lldb_lookup.StdPathBufSummaryProvider -e -x -h "^(std::([a-z_]+::)+)PathBuf$" --category Rust - -# Path -type summary add -F lldb_lookup.StdPathSummaryProvider -e -x -h "^&(mut )?(std::([a-z_]+::)+)Path$" --category Rust - -# Enum -# type summary add -F lldb_lookup.ClangEncodedEnumSummaryProvider -e -h "lldb_lookup.is_sum_type_enum" --recognizer-function --category Rust -## MSVC -type synthetic add -l lldb_lookup.MSVCEnumSyntheticProvider -x "^enum2\$<.+>$" --category Rust -type summary add -F lldb_lookup.MSVCEnumSummaryProvider -e -x -h "^enum2\$<.+>$" --category Rust - -## MSVC Variants -type synthetic add -l lldb_lookup.synthetic_lookup -x "^enum2\$<.+>::.*$" --category Rust - -# Tuple -type synthetic add -l lldb_lookup.TupleSyntheticProvider -x "^\(.*\)$" --category Rust -type summary add -F lldb_lookup.TupleSummaryProvider -x "^\(.*\)$" --category Rust - -## MSVC -type synthetic add -l lldb_lookup.MSVCTupleSyntheticProvider -x "^tuple\$<.+>$" --category Rust -type summary add -F lldb_lookup.TupleSummaryProvider -e -x -h "^tuple\$<.+>$" --category Rust - -type category enable Rust diff --git a/src/etc/lldb_lookup.py b/src/etc/lldb_lookup.py index 67194a09ec4ce..57dbfbc40909f 100644 --- a/src/etc/lldb_lookup.py +++ b/src/etc/lldb_lookup.py @@ -1,10 +1,45 @@ from __future__ import annotations -from typing import List - +from typing import TYPE_CHECKING, List, Callable import lldb -from lldb_providers import * +from lldb_providers import ( + LLDBFeature, + FEATURE_FLAGS, + LLDBOpaque, + StructSyntheticProvider, + StdHashMapSyntheticProvider, + StdOldHashMapSyntheticProvider, + StdRcSyntheticProvider, + TupleSyntheticProvider, + EmptySyntheticProvider, + ClangEncodedEnumProvider, + DefaultSyntheticProvider, + StdStringSyntheticProvider, + StdStringSummaryProvider, + StdSliceSyntheticProvider, + StdStrSummaryProvider, + MSVCStrSyntheticProvider, + SizeSummaryProvider, + MSVCStdSliceSyntheticProvider, + StdSliceSummaryProvider, + StdOsStringSummaryProvider, + StdVecSyntheticProvider, + StdVecDequeSyntheticProvider, + StdRcSummaryProvider, + StdCellSyntheticProvider, + StdRefSyntheticProvider, + StdRefSummaryProvider, + StdNonZeroNumberSummaryProvider, + StdPathBufSummaryProvider, + StdPathSummaryProvider, + MSVCEnumSyntheticProvider, + MSVCEnumSummaryProvider, + TupleSummaryProvider, + MSVCTupleSyntheticProvider, + ClangEncodedEnumSummaryProvider, + StructSummaryProvider, +) from rust_types import ( ENUM_DISR_FIELD_NAME, ENUM_LLDB_ENCODED_VARIANTS, @@ -13,6 +48,9 @@ is_tuple_fields, ) +if TYPE_CHECKING: + from lldb import SBValue + #################################################################################################### # This file contains lookup functions that associate rust types with their synthetic/summary # providers. @@ -31,6 +69,302 @@ # (see: `classify_hashmap()` vs `classify_hashset()`). #################################################################################################### +RUST_CATEGORY: lldb.SBTypeCategory = lldb.SBTypeCategory() +MOD_PREFIX = f"{__name__}." + +DEFAULT_TYPE_OPTIONS: int = ( + # ensure it applies through typedef chains + lldb.eTypeOptionCascade + | lldb.eTypeOptionHideEmptyAggregates + # helps us reason about what types can be put through the synthetic provider. + # this is important because of the `update` logic as well as when working with + # type information, since we almost always want to work on the pointee type/pointee's + # template args. These options allow us to know that the type we have is never a pointer-to + # the type we want + | lldb.eTypeOptionFrontEndWantsDereference +) + + +def __lldb_init_module(debugger: lldb.SBDebugger, _dict: LLDBOpaque): + global RUST_CATEGORY + RUST_CATEGORY = debugger.GetCategory("Rust") + + if not RUST_CATEGORY.IsValid(): + RUST_CATEGORY = debugger.CreateCategory("Rust") + + RUST_CATEGORY.SetEnabled(True) + + # BUG: This specifier is used to determine whether or not visualizers in this category shoud be + # used for the given executable. It defaults to `lldb.eLanguageTypeUnknown` which will be active + # regardless of the executable's reported language, but setting it to `rust` would be ideal + # so that our visualizers do not apply to, for example, C++ code when debugging across FFI + # boundaries. + # We cannot currently enable this though, as this query defers to the `TypeSystem` (in our case, + # `TypeSystemClang`). `TypeSystemClang::SupportsLanguage` includes Rust, which allows Rust + # support in LLDB, but SBTypeCategory instead checks + # `TypeSystemClang::GetSupportedLanguagesForTypes` which only includes various C and C++ + # versions. I'm not sure if Rust should be added to that function or not, but in the meantime + # cannot directly specify that Rust is the intended language for this category. + + # RUST_CATEGORY.AddLanguage(lldb.eLanguageTypeRust) + + global FEATURE_FLAGS + # Most feature checks should be possible via simple "does this API exist at all" checks. + if getattr(lldb.SBType, "GetStaticFieldWithName", None) is not None: + FEATURE_FLAGS |= LLDBFeature.StaticFields + if getattr(lldb, "eFormatterMatchCallback", None) is not None: + FEATURE_FLAGS |= LLDBFeature.TypeRecognizers + + register_providers_compatibility() + + +def register_providers_compatibility(): + """ + Adds providers to global `RUST_CATEGORY`. Does not attempt to use type recognizers + + The order that providers are added matters. Existing providers are iterated through in **reverse + order** when finding a match, allowing new providers to "overwrite" old providers. Be very + careful when modifying the order that providers are added. + """ + + global RUST_CATEGORY + + if LLDBFeature.TypeRecognizers in FEATURE_FLAGS: + # FIXME: this can be removed once full support for type recognizers is added. + # This prevents a semi-unfixable regression for CodeLLDB + register_synth( + synthetic_lookup, + lldb.SBTypeNameSpecifier( + MOD_PREFIX + is_udt.__name__, + lldb.eFormatterMatchCallback, + ), + lldb.eTypeOptionCascade, + ) + + # enforce uniform aggregate formatting + register_summary( + StructSummaryProvider, + lldb.SBTypeNameSpecifier( + MOD_PREFIX + is_udt.__name__, + lldb.eFormatterMatchCallback, + ), + lldb.eTypeOptionCascade + | lldb.eTypeOptionHideEmptyAggregates + | lldb.eTypeOptionHideChildren, + ) + else: + # Need to toss any remaining types through this so that GNU enums are caught + register_synth( + synthetic_lookup, + lldb.SBTypeNameSpecifier(r".*", True), + ) + + # String + register( + StdStringSyntheticProvider, + StdStringSummaryProvider, + r"^(alloc::([a-z_]+::)+)String$", + ) + + # str GNU + register( + StdSliceSyntheticProvider, + StdStrSummaryProvider, + r"^&(mut )?str$", + ) + + # str MSVC + register( + MSVCStrSyntheticProvider, + StdStrSummaryProvider, + r"^ref(_mut)?\$$", + ) + + # slice GNU + register( + StdSliceSyntheticProvider, + SizeSummaryProvider, + r"^&(mut )?\[.+\]$", + ) + + # slice MSVC + register( + MSVCStdSliceSyntheticProvider, + StdSliceSummaryProvider, + r"^ref(_mut)?\$ >", + ) + + # OsString + register_summary( + StdOsStringSummaryProvider, + lldb.SBTypeNameSpecifier(r"^(std::ffi::([a-z_]+::)+)OsString$", True), + ) + + # Vec + register( + StdVecSyntheticProvider, + SizeSummaryProvider, + r"^(alloc::([a-z_]+::)+)Vec<.+>$", + ) + + # VecDeque + register( + StdVecDequeSyntheticProvider, + SizeSummaryProvider, + r"^(alloc::([a-z_]+::)+)VecDeque<.+>$", + ) + + # HashMap + register( + classify_hashmap, + SizeSummaryProvider, + r"^(std::collections::([a-z_]+::)+)HashMap<.+>$", + ) + + # HashSet + register( + classify_hashset, + SizeSummaryProvider, + r"^(std::collections::([a-z_]+::)+)HashSet<.+>$", + ) + + # Rc + register( + StdRcSyntheticProvider, + StdRcSummaryProvider, + r"^(alloc::([a-z_]+::)+)Rc<.+>$", + ) + + # Arc + register( + arc_synthetic, + StdRcSummaryProvider, + r"^(alloc::([a-z_]+::)+)Arc<.+>$", + ) + + # Cell + register_synth( + StdCellSyntheticProvider, + lldb.SBTypeNameSpecifier( + r"^(core::([a-z_]+::)+)Cell<.+>$", + True, + ), + ) + + # RefCell + register( + StdRefSyntheticProvider, + StdRefSummaryProvider, + r"^(core::([a-z_]+::)+)Ref(Cell|Mut)?<.+>$", + ) + + # NonZero + register_summary( + StdNonZeroNumberSummaryProvider, + lldb.SBTypeNameSpecifier( + r"^(core::([a-z_]+::)+)NonZero(<.+>|I\d{0,3}|U\d{0,3})$", + True, + ), + ) + + # PathBuf + register_summary( + StdPathBufSummaryProvider, + lldb.SBTypeNameSpecifier( + r"^(std::([a-z_]+::)+)PathBuf$", + True, + ), + ) + + # Path + register_summary( + StdPathSummaryProvider, + lldb.SBTypeNameSpecifier( + r"^&(mut )?(std::([a-z_]+::)+)Path$", + True, + ), + ) + + # Enum MSVC + register( + MSVCEnumSyntheticProvider, + MSVCEnumSummaryProvider, + r"^enum2\$<.+>$", + ) + + # Tuple GNU + register( + TupleSyntheticProvider, + TupleSummaryProvider, + r"^\(.*\)$", + type_options=DEFAULT_TYPE_OPTIONS | lldb.eTypeOptionHideChildren, + ) + + # Tuple MSVC + register( + MSVCTupleSyntheticProvider, + TupleSummaryProvider, + r"^tuple\$<.+>$", + ) + + +def register( + synth_provider: Callable[[SBValue, LLDBOpaque], object], + summary_provider: Callable[[SBValue, LLDBOpaque], str], + match_str, + regex: bool = True, + type_options: int = DEFAULT_TYPE_OPTIONS, +): + global RUST_CATEGORY + sb_name: lldb.SBTypeNameSpecifier = lldb.SBTypeNameSpecifier(match_str, regex) + + register_synth(synth_provider, sb_name, type_options) + register_summary(summary_provider, sb_name, type_options) + + +def register_synth( + provider: Callable[[SBValue, LLDBOpaque], object], + sb_name: lldb.SBTypeNameSpecifier, + type_options: int = DEFAULT_TYPE_OPTIONS, +): + sb_synth: lldb.SBTypeSynthetic = lldb.SBTypeSynthetic.CreateWithClassName( + MOD_PREFIX + provider.__name__ + ) + sb_synth.SetOptions(type_options) + + global RUST_CATEGORY + # returns false for failures, does not provide any info to determine what the failure was + + res: bool = RUST_CATEGORY.AddTypeSynthetic(sb_name, sb_synth) + + if not res: + print( + "Warning: unable to register summary: " + + f"{MOD_PREFIX + provider.__name__} with specifier '{sb_name.GetName()}'" + ) + + +def register_summary( + provider: Callable[[SBValue, LLDBOpaque], object], + sb_name: lldb.SBTypeNameSpecifier, + type_options: int = DEFAULT_TYPE_OPTIONS, +): + sb_summary: lldb.SBTypeSummary = lldb.SBTypeSummary.CreateWithFunctionName( + MOD_PREFIX + provider.__name__ + ) + + sb_summary.SetOptions(type_options) + + global RUST_CATEGORY + # returns false for failures, does not provide any info to determine what the failure was + res: bool = RUST_CATEGORY.AddTypeSummary(sb_name, sb_summary) + + if not res: + print( + "Warning: unable to register summary: " + + f"{MOD_PREFIX + provider.__name__} with specifier '{sb_name.GetName()}'" + ) + # BACKCOMPAT: rust 1.35 def is_hashbrown_hashmap(hash_map: lldb.SBValue) -> bool: @@ -56,6 +390,15 @@ def arc_synthetic(valobj: lldb.SBValue, _dict: LLDBOpaque) -> object: return StdRcSyntheticProvider(valobj, _dict, is_atomic=True) +def is_udt(type: lldb.SBType, _dict: LLDBOpaque) -> bool: + return ( + type.GetBasicType() == lldb.eBasicTypeInvalid + and not type.IsScopedEnumerationType() + and not type.IsPointerType() + and not type.IsArrayType() + ) + + def classify_rust_type(type: lldb.SBType, is_msvc: bool) -> RustType: if type.IsPointerType(): return RustType.Indirection @@ -133,16 +476,16 @@ def synthetic_lookup(valobj: lldb.SBValue, _dict: LLDBOpaque) -> object: or summary.summary_data.strip() != "lldb_lookup.ClangEncodedEnumSummaryProvider(valobj,internal_dict)" ): - rust_category: lldb.SBTypeCategory = lldb.debugger.GetCategory("Rust") - rust_category.AddTypeSummary( + sb_summary = lldb.SBTypeSummary().CreateWithFunctionName( + MOD_PREFIX + ClangEncodedEnumSummaryProvider.__name__ + ) + sb_summary.SetOptions(DEFAULT_TYPE_OPTIONS) + + RUST_CATEGORY.AddTypeSummary( lldb.SBTypeNameSpecifier(valobj.GetTypeName()), - lldb.SBTypeSummary().CreateWithFunctionName( - "lldb_lookup.ClangEncodedEnumSummaryProvider" - ), + sb_summary, ) return ClangEncodedEnumProvider(valobj, _dict) - if rust_type == RustType.Indirection: - return IndirectionSyntheticProvider(valobj, _dict) return DefaultSyntheticProvider(valobj, _dict) diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 65f20210323eb..b45db6ee92c0d 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -1,6 +1,7 @@ from __future__ import annotations import sys from typing import Generator, List, TYPE_CHECKING, Optional +from enum import Flag, auto from lldb import ( SBData, @@ -53,6 +54,24 @@ PY3 = sys.version_info[0] == 3 +class LLDBFeature(Flag): + """Used to track which features we rely on and whether or not we can access them. The global + `lldb_providers.FEATURE_FLAGS` is initialized in `lldb_lookup.__lldb_init_module` and is + expected not to change after that point. + + This is used rather than `debugger.GetVersionString` because Apple's fork of LLDB (used for + xcode) uses a non-standard versioning scheme that has no relation to LLVM's. + """ + + StaticFields = auto() + """Added in LLDB 18. unctions to `SBType` the inspection of a struct's static fields.""" + TypeRecognizers = auto() + """Added in LLDB 19. Callback-based type matching for synthetic/summary providers.""" + + +FEATURE_FLAGS: LLDBFeature = LLDBFeature(0) + + class LLDBOpaque: """ An marker type for use in type hints to denote LLDB bookkeeping variables. Values marked with @@ -70,14 +89,18 @@ def __init__(self, valobj: SBValue): def from_int(self, name: str, value: int) -> SBValue: type = self.valobj.GetType().GetBasicType(eBasicTypeLong) data = SBData.CreateDataFromSInt64Array( - self.endianness, self.pointer_size, [value] + self.endianness, + self.pointer_size, + [value], ) return self.valobj.CreateValueFromData(name, data, type) def from_uint(self, name: str, value: int) -> SBValue: type = self.valobj.GetType().GetBasicType(eBasicTypeUnsignedLong) data = SBData.CreateDataFromUInt64Array( - self.endianness, self.pointer_size, [value] + self.endianness, + self.pointer_size, + [value], ) return self.valobj.CreateValueFromData(name, data, type) @@ -123,37 +146,6 @@ def get_value(self): return self.valobj.value -class IndirectionSyntheticProvider: - def __init__(self, valobj: SBValue, _dict: LLDBOpaque): - self.valobj = valobj - - def num_children(self) -> int: - return 1 - - def get_child_index(self, name: str) -> int: - if name == "$$dereference$$": - return 0 - return -1 - - def get_child_at_index(self, index: int) -> Optional[SBValue]: - if index == 0: - value = self.valobj.Dereference() - if (synth := value.GetSyntheticValue()).IsValid(): - return synth - else: - return value - return None - - def update(self): - pass - - def has_children(self) -> bool: - return True - - def get_value(self): - return self.valobj.value - - class EmptySyntheticProvider: def __init__(self, valobj: SBValue, _dict: LLDBOpaque): # logger = Logger.Logger() @@ -592,6 +584,8 @@ def _getCurrentVariantIndex(self, all_variants: SBValue) -> int: def ClangEncodedEnumSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str: + if valobj.TypeIsPointerType(): + valobj = valobj.Dereference() enum_synth = ClangEncodedEnumProvider(valobj.GetNonSyntheticValue(), _dict) variant = enum_synth.variant name = _getVariantName(variant) @@ -624,6 +618,10 @@ class MSVCEnumSyntheticProvider: def __init__(self, valobj: SBValue, _dict: LLDBOpaque): self.valobj = valobj + # This allows the summary provider to still print something + # even if we can't find the variant for whatever reason + self.variant = valobj + self.value = valobj self.update() def update(self): diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb index f8f31903060c3..91c6591171392 100755 --- a/src/etc/rust-lldb +++ b/src/etc/rust-lldb @@ -31,7 +31,6 @@ EOF fi script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\"" -commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands" # Call LLDB with the commands added to the argument list -exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@" +exec "$lldb" --one-line-before-file "$script_import" "$@" diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index f2f13bc882647..b5236762e1093 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -1,6 +1,5 @@ use std::ffi::{OsStr, OsString}; -use std::fs::File; -use std::io::{BufRead, BufReader, Read}; +use std::io::{BufRead, BufReader}; use std::process::{Command, Output, Stdio}; use camino::Utf8Path; @@ -407,9 +406,6 @@ impl TestCx<'_> { "command script import {}/lldb_lookup.py\n", rust_pp_module_abs_path )); - File::open(rust_pp_module_abs_path.join("lldb_commands")) - .and_then(|mut file| file.read_to_string(&mut script_str)) - .expect("Failed to read lldb_commands"); // Set breakpoints on every line that contains the string "#break" let source_file_name = self.testpaths.file.file_name().unwrap(); From 86b1a93896ea6f565d8d81f9d0c84a726cd58f94 Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Tue, 28 Apr 2026 02:40:58 -0500 Subject: [PATCH 2/2] update tests w/ new struct summary --- tests/debuginfo/associated-types.rs | 2 +- tests/debuginfo/borrowed-struct.rs | 6 +++--- tests/debuginfo/boxed-struct.rs | 4 ++-- .../by-value-self-argument-in-trait-impl.rs | 2 +- tests/debuginfo/c-style-enum-in-composite.rs | 6 +++--- tests/debuginfo/captured-fields-1.rs | 12 ++++++------ tests/debuginfo/destructured-fn-argument.rs | 4 ++-- .../debuginfo/destructured-for-loop-variable.rs | 2 +- tests/debuginfo/destructured-local.rs | 4 ++-- tests/debuginfo/evec-in-struct.rs | 10 +++++----- tests/debuginfo/generic-function.rs | 2 +- .../generic-method-on-generic-struct.rs | 10 +++++----- tests/debuginfo/generic-struct.rs | 8 ++++---- tests/debuginfo/issue-22656.rs | 2 +- tests/debuginfo/method-on-generic-struct.rs | 10 +++++----- tests/debuginfo/method-on-struct.rs | 10 +++++----- tests/debuginfo/method-on-trait.rs | 10 +++++----- tests/debuginfo/method-on-tuple-struct.rs | 10 +++++----- tests/debuginfo/packed-struct-with-destructor.rs | 16 ++++++++-------- tests/debuginfo/packed-struct.rs | 8 ++++---- tests/debuginfo/path.rs | 12 ++++-------- tests/debuginfo/self-in-default-method.rs | 10 +++++----- .../debuginfo/self-in-generic-default-method.rs | 10 +++++----- tests/debuginfo/simple-struct.rs | 12 ++++++------ tests/debuginfo/struct-in-struct.rs | 16 ++++++++-------- tests/debuginfo/struct-with-destructor.rs | 8 ++++---- tests/debuginfo/tuple-struct.rs | 12 ++++++------ tests/debuginfo/union-smoke.rs | 4 ++-- .../debuginfo/var-captured-in-nested-closure.rs | 8 ++++---- .../var-captured-in-sendable-closure.rs | 2 +- tests/debuginfo/var-captured-in-stack-closure.rs | 8 ++++---- tests/debuginfo/vec-slices.rs | 2 +- tests/debuginfo/vec.rs | 2 +- 33 files changed, 120 insertions(+), 124 deletions(-) diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index 5944cc14a1e81..f61e76cbe5997 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -39,7 +39,7 @@ //@ lldb-command:run //@ lldb-command:v arg -//@ lldb-check:[...] { b = -1 b1 = 0 } +//@ lldb-check:[...] {b:-1, b1:0} //@ lldb-command:continue //@ lldb-command:v inferred diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index fccca09e91bb6..0326fb6fa0b3b 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -33,7 +33,7 @@ //@ lldb-command:run //@ lldb-command:v *stack_val_ref -//@ lldb-check:[...] { x = 10 y = 23.5 } +//@ lldb-check:[...] {x:10, y:23.5} //@ lldb-command:v *stack_val_interior_ref_1 //@ lldb-check:[...] 10 @@ -42,10 +42,10 @@ //@ lldb-check:[...] 23.5 //@ lldb-command:v *ref_to_unnamed -//@ lldb-check:[...] { x = 11 y = 24.5 } +//@ lldb-check:[...] {x:11, y:24.5} //@ lldb-command:v *unique_val_ref -//@ lldb-check:[...] { x = 13 y = 26.5 } +//@ lldb-check:[...] {x:13, y:26.5} //@ lldb-command:v *unique_val_interior_ref_1 //@ lldb-check:[...] 13 diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 4990a189f2f1f..03897177959eb 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -18,10 +18,10 @@ //@ lldb-command:run //@ lldb-command:v *boxed_with_padding -//@ lldb-check:[...] { x = 99 y = 999 z = 9999 w = 99999 } +//@ lldb-check:[...] {x:99, y:999, z:9999, w:99999} //@ lldb-command:v *boxed_with_dtor -//@ lldb-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } +//@ lldb-check:[...] {x:77, y:777, z:7777, w:77777} #![allow(unused_variables)] diff --git a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs index 42874f9afe10c..9b616ba2fce5b 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -28,7 +28,7 @@ //@ lldb-command:continue //@ lldb-command:v self -//@ lldb-check:[...] { x = 2222 y = 3333 } +//@ lldb-check:[...] {x:2222, y:3333} //@ lldb-command:continue //@ lldb-command:v self diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 2362eee008bbf..6839c07cd55a5 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -41,13 +41,13 @@ //@ lldb-check:[...] (OneThousand, MountainView, OneMillion, Vienna) //@ lldb-command:v padded_struct -//@ lldb-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } +//@ lldb-check:[...] {a:3, b:OneMillion, c:4, d:Toronto, e:5} //@ lldb-command:v packed_struct -//@ lldb-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } +//@ lldb-check:[...] {a:6, b:OneHundred, c:7, d:Vienna, e:8} //@ lldb-command:v non_padded_struct -//@ lldb-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto } +//@ lldb-check:[...] {a:OneMillion, b:MountainView, c:OneThousand, d:Toronto} //@ lldb-command:v struct_with_drop //@ lldb-check:[...] ({a:OneHundred, b:Vienna}, 9) diff --git a/tests/debuginfo/captured-fields-1.rs b/tests/debuginfo/captured-fields-1.rs index 81651331519c7..68e8a9c418343 100644 --- a/tests/debuginfo/captured-fields-1.rs +++ b/tests/debuginfo/captured-fields-1.rs @@ -27,22 +27,22 @@ //@ lldb-command:run //@ lldb-command:v test -//@ lldb-check:(captured_fields_1::main::{closure_env#0}) test = { _ref__my_ref__my_field1 = 0x[...] } +//@ lldb-check:(captured_fields_1::main::{closure_env#0}) test = {_ref__my_ref__my_field1:0x[...]} //@ lldb-command:continue //@ lldb-command:v test -//@ lldb-check:(captured_fields_1::main::{closure_env#1}) test = { _ref__my_ref__my_field2 = 0x[...] } +//@ lldb-check:(captured_fields_1::main::{closure_env#1}) test = {_ref__my_ref__my_field2:0x[...]} //@ lldb-command:continue //@ lldb-command:v test -//@ lldb-check:(captured_fields_1::main::{closure_env#2}) test = { _ref__my_ref = 0x[...] } +//@ lldb-check:(captured_fields_1::main::{closure_env#2}) test = {_ref__my_ref:0x[...]} //@ lldb-command:continue //@ lldb-command:v test -//@ lldb-check:(captured_fields_1::main::{closure_env#3}) test = { my_ref = 0x[...] } +//@ lldb-check:(captured_fields_1::main::{closure_env#3}) test = {my_ref:{my_field1:11, my_field2:22}} //@ lldb-command:continue //@ lldb-command:v test -//@ lldb-check:(captured_fields_1::main::{closure_env#4}) test = { my_var__my_field2 = 22 } +//@ lldb-check:(captured_fields_1::main::{closure_env#4}) test = {my_var__my_field2:22} //@ lldb-command:continue //@ lldb-command:v test -//@ lldb-check:(captured_fields_1::main::{closure_env#5}) test = { my_var = { my_field1 = 11 my_field2 = 22 } } +//@ lldb-check:(captured_fields_1::main::{closure_env#5}) test = {my_var:{my_field1:11, my_field2:22}} //@ lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index def1d159c598e..c61f0240049d7 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -178,7 +178,7 @@ //@ lldb-command:v h //@ lldb-check:[...] 8 //@ lldb-command:v i -//@ lldb-check:[...] { a = 9 b = 10 } +//@ lldb-check:[...] {a:9, b:10} //@ lldb-command:v j //@ lldb-check:[...] 11 //@ lldb-command:continue @@ -204,7 +204,7 @@ //@ lldb-command:v q //@ lldb-check:[...] 20 //@ lldb-command:v r -//@ lldb-check:[...] { a = 21 b = 22 } +//@ lldb-check:[...] {a:21, b:22} //@ lldb-command:continue //@ lldb-command:v s diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index 5febb9e77e71c..7e5420f167631 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -134,7 +134,7 @@ //@ lldb-command:continue //@ lldb-command:v simple_struct_ident -//@ lldb-check:[...] { x = 3537 y = 35437.5 z = true } +//@ lldb-check:[...] {x:3537, y:35437.5, z:true} //@ lldb-command:continue //@ lldb-command:v simple_tuple_ident diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index 0f7667a135209..07f35540483ef 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -141,7 +141,7 @@ //@ lldb-command:v h //@ lldb-check:[...] 8 //@ lldb-command:v i -//@ lldb-check:[...] { a = 9 b = 10 } +//@ lldb-check:[...] {a:9, b:10} //@ lldb-command:v j //@ lldb-check:[...] 11 @@ -163,7 +163,7 @@ //@ lldb-command:v q //@ lldb-check:[...] 20 //@ lldb-command:v r -//@ lldb-check:[...] { a = 21 b = 22 } +//@ lldb-check:[...] {a:21, b:22} //@ lldb-command:v s //@ lldb-check:[...] 24 diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index bbcad48259e00..44e7d359d81ec 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -26,18 +26,18 @@ //@ lldb-command:run //@ lldb-command:v no_padding1 -//@ lldb-check:[...] { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } +//@ lldb-check:[...] {x:(0, 1, 2), y:-3, z:(4.5, 5.5)} //@ lldb-command:v no_padding2 -//@ lldb-check:[...] { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } +//@ lldb-check:[...] {x:(6, 7, 8), y:((9, 10), (11, 12))} //@ lldb-command:v struct_internal_padding -//@ lldb-check:[...] { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } +//@ lldb-check:[...] {x:(13, 14), y:(15, 16)} //@ lldb-command:v single_vec -//@ lldb-check:[...] { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } +//@ lldb-check:[...] {x:(17, 18, 19, 20, 21)} //@ lldb-command:v struct_padded_at_end -//@ lldb-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } +//@ lldb-check:[...] {x:(22, 23), y:(24, 25)} #![allow(unused_variables)] diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index 4e66021b633cc..4bfee083fc7f2 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -43,7 +43,7 @@ //@ lldb-command:v *t0 //@ lldb-check:[...] 5 //@ lldb-command:v *t1 -//@ lldb-check:[...] { a = 6 b = 7.5 } +//@ lldb-check:[...] {a:6, b:7.5} //@ lldb-command:continue #[derive(Clone)] diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index 6ec2151e2cdb9..1b3bdb9d46502 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = (8888, -8888) } +//@ lldb-check:[...] {x:(8888, -8888)} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = (8888, -8888) } +//@ lldb-check:[...] {x:(8888, -8888)} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 1234.5 } +//@ lldb-check:[...] {x:1234.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 1234.5 } +//@ lldb-check:[...] {x:1234.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...] { x = 1234.5 } +//@ lldb-check:[...] {x:1234.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index e6e56e288e8d0..945a0cdc2da38 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -20,14 +20,14 @@ //@ lldb-command:run //@ lldb-command:v int_int -//@ lldb-check:[...]AGenericStruct) int_int = { key = 0 value = 1 } +//@ lldb-check:[...]AGenericStruct) int_int = {key:0, value:1} //@ lldb-command:v int_float -//@ lldb-check:[...]AGenericStruct) int_float = { key = 2 value = 3.5 } +//@ lldb-check:[...]AGenericStruct) int_float = {key:2, value:3.5} //@ lldb-command:v float_int -//@ lldb-check:[...]AGenericStruct) float_int = { key = 4.5 value = 5 } +//@ lldb-check:[...]AGenericStruct) float_int = {key:4.5, value:5} //@ lldb-command:v float_int_float -//@ lldb-check:[...]AGenericStruct >) float_int_float = { key = 6.5 value = { key = 7 value = 8.5 } } +//@ lldb-check:[...]AGenericStruct >) float_int_float = {key:6.5, value:{key:7, value:8.5}} // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index 54c381b4e76ab..c552132c4de50 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -13,7 +13,7 @@ //@ lldb-command:v v //@ lldb-check:[...] size=3 { [0] = 1 [1] = 2 [2] = 3 } //@ lldb-command:v zs -//@ lldb-check:[...] { x = y = 123 z = w = 456 } +//@ lldb-check:[...] {x:{}, y:123, z:{}, w:456} #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 6194cd58bbb0d..f154e46b2d578 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...]Struct<(u32, i32)>) *self = { x = (8888, -8888) } +//@ lldb-check:[...]Struct<(u32, i32)>) *self = {x:(8888, -8888)} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...]Struct<(u32, i32)>) self = { x = (8888, -8888) } +//@ lldb-check:[...]Struct<(u32, i32)>) self = {x:(8888, -8888)} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...]Struct) *self = { x = 1234.5 } +//@ lldb-check:[...]Struct) *self = {x:1234.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...]Struct) self = { x = 1234.5 } +//@ lldb-check:[...]Struct) self = {x:1234.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...]Struct) *self = { x = 1234.5 } +//@ lldb-check:[...]Struct) *self = {x:1234.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index 5a4c275e7041e..73e7401002db2 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 100 } +//@ lldb-check:[...] {x:100} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 100 } +//@ lldb-check:[...] {x:100} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index 673d25a72845b..41a9d48f9257c 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 100 } +//@ lldb-check:[...] {x:100} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 100 } +//@ lldb-check:[...] {x:100} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 03c00d668741c..3f9bda6790ee8 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { 0 = 100 1 = -100.5 } +//@ lldb-check:[...] {0:100, 1:-100.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { 0 = 100 1 = -100.5 } +//@ lldb-check:[...] {0:100, 1:-100.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { 0 = 200 1 = -200.5 } +//@ lldb-check:[...] {0:200, 1:-200.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { 0 = 200 1 = -200.5 } +//@ lldb-check:[...] {0:200, 1:-200.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...] { 0 = 200 1 = -200.5 } +//@ lldb-check:[...] {0:200, 1:-200.5} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index ec656f7ae6126..59fc3d3ca15c2 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -37,28 +37,28 @@ //@ lldb-command:run //@ lldb-command:v packed -//@ lldb-check:[...] { x = 123 y = 234 z = 345 } +//@ lldb-check:[...] {x:123, y:234, z:345} //@ lldb-command:v packedInPacked -//@ lldb-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +//@ lldb-check:[...] {a:1111, b:{x:2222, y:3333, z:4444}, c:5555, d:{x:6666, y:7777, z:8888}} //@ lldb-command:v packedInUnpacked -//@ lldb-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +//@ lldb-check:[...] {a:-1111, b:{x:-2222, y:-3333, z:-4444}, c:-5555, d:{x:-6666, y:-7777, z:-8888}} //@ lldb-command:v unpackedInPacked -//@ lldb-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } +//@ lldb-check:[...] {a:987, b:{x:876, y:765, z:654}, c:{x:543, y:432, z:321}, d:210} //@ lldb-command:v packedInPackedWithDrop -//@ lldb-check:[...] { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } +//@ lldb-check:[...] {a:11, b:{x:22, y:33, z:44}, c:55, d:{x:66, y:77, z:88}} //@ lldb-command:v packedInUnpackedWithDrop -//@ lldb-check:[...] { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } +//@ lldb-check:[...] {a:-11, b:{x:-22, y:-33, z:-44}, c:-55, d:{x:-66, y:-77, z:-88}} //@ lldb-command:v unpackedInPackedWithDrop -//@ lldb-check:[...] { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } +//@ lldb-check:[...] {a:98, b:{x:87, y:76, z:65}, c:{x:54, y:43, z:32}, d:21} //@ lldb-command:v deeplyNested -//@ lldb-check:[...] { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } +//@ lldb-check:[...] {a:{a:1, b:{x:2, y:3, z:4}, c:5, d:{x:6, y:7, z:8}}, b:{a:9, b:{x:10, y:11, z:12}, c:{x:13, y:14, z:15}, d:16}, c:{a:17, b:{x:18, y:19, z:20}, c:21, d:{x:22, y:23, z:24}}, d:{a:25, b:{x:26, y:27, z:28}, c:29, d:{x:30, y:31, z:32}}, e:{a:33, b:{x:34, y:35, z:36}, c:{x:37, y:38, z:39}, d:40}, f:{a:41, b:{x:42, y:43, z:44}, c:45, d:{x:46, y:47, z:48}}} #![allow(unused_variables)] diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 38f846502af44..e601ac1ffc6a2 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -30,16 +30,16 @@ //@ lldb-command:run //@ lldb-command:v packed -//@ lldb-check:[...] { x = 123 y = 234 z = 345 } +//@ lldb-check:[...] {x:123, y:234, z:345} //@ lldb-command:v packedInPacked -//@ lldb-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +//@ lldb-check:[...] {a:1111, b:{x:2222, y:3333, z:4444}, c:5555, d:{x:6666, y:7777, z:8888}} //@ lldb-command:v packedInUnpacked -//@ lldb-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +//@ lldb-check:[...] {a:-1111, b:{x:-2222, y:-3333, z:-4444}, c:-5555, d:{x:-6666, y:-7777, z:-8888}} //@ lldb-command:v unpackedInPacked -//@ lldb-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } +//@ lldb-check:[...] {a:987, b:{x:876, y:765, z:654, w:543}, c:{x:432, y:321, z:210, w:109}, d:-98} //@ lldb-command:expr sizeof(packed) //@ lldb-check:[...] 14 diff --git a/tests/debuginfo/path.rs b/tests/debuginfo/path.rs index 27b518fd89751..f2bbf8ce36611 100644 --- a/tests/debuginfo/path.rs +++ b/tests/debuginfo/path.rs @@ -6,14 +6,10 @@ //@ lldb-command:run -//@ lldb-command:print pathbuf -//@ lldb-check:[...] "/some/path" { inner = "/some/path" { inner = { inner = size=10 { [0] = '/' [1] = 's' [2] = 'o' [3] = 'm' [4] = 'e' [5] = '/' [6] = 'p' [7] = 'a' [8] = 't' [9] = 'h' } } } } -//@ lldb-command:po pathbuf -//@ lldb-check:"/some/path" -//@ lldb-command:print path -//@ lldb-check:[...] "/some/path" { data_ptr = [...] length = 10 } -//@ lldb-command:po path -//@ lldb-check:"/some/path" +//@ lldb-command:v pathbuf +//@ lldb-check:[...] "/some/path" [...] +//@ lldb-command:v path +//@ lldb-check:[...] "/some/path" [...] use std::path::Path; diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index 41e4ffc389b97..0ed8e233d4790 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 100 } +//@ lldb-check:[...] {x:100} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 100 } +//@ lldb-check:[...] {x:100} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...] { x = 200 } +//@ lldb-check:[...] {x:200} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index 401d65291d35d..12cdfecfefb40 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -58,7 +58,7 @@ // STACK BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 987 } +//@ lldb-check:[...] {x:987} //@ lldb-command:v arg1 //@ lldb-check:[...] -1 //@ lldb-command:v arg2 @@ -67,7 +67,7 @@ // STACK BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 987 } +//@ lldb-check:[...] {x:987} //@ lldb-command:v arg1 //@ lldb-check:[...] -3 //@ lldb-command:v arg2 @@ -76,7 +76,7 @@ // OWNED BY REF //@ lldb-command:v *self -//@ lldb-check:[...] { x = 879 } +//@ lldb-check:[...] {x:879} //@ lldb-command:v arg1 //@ lldb-check:[...] -5 //@ lldb-command:v arg2 @@ -85,7 +85,7 @@ // OWNED BY VAL //@ lldb-command:v self -//@ lldb-check:[...] { x = 879 } +//@ lldb-check:[...] {x:879} //@ lldb-command:v arg1 //@ lldb-check:[...] -7 //@ lldb-command:v arg2 @@ -94,7 +94,7 @@ // OWNED MOVED //@ lldb-command:v *self -//@ lldb-check:[...] { x = 879 } +//@ lldb-check:[...] {x:879} //@ lldb-command:v arg1 //@ lldb-check:[...] -9 //@ lldb-command:v arg2 diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index a67dc13a5d433..fe42e9d1421f1 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -67,22 +67,22 @@ //@ lldb-command:run //@ lldb-command:v no_padding16 -//@ lldb-check:[...] { x = 10000 y = -10001 } +//@ lldb-check:[...] {x:10000, y:-10001} //@ lldb-command:v no_padding32 -//@ lldb-check:[...] { x = -10002 y = -10003.5 z = 10004 } +//@ lldb-check:[...] {x:-10002, y:-10003.5, z:10004} //@ lldb-command:v no_padding64 -//@ lldb-check:[...] { x = -10005.5 y = 10006 z = 10007 } +//@ lldb-check:[...] {x:-10005.5, y:10006, z:10007} //@ lldb-command:v no_padding163264 -//@ lldb-check:[...] { a = -10008 b = 10009 c = 10010 d = 10011 } +//@ lldb-check:[...] {a:-10008, b:10009, c:10010, d:10011} //@ lldb-command:v internal_padding -//@ lldb-check:[...] { x = 10012 y = -10013 } +//@ lldb-check:[...] {x:10012, y:-10013} //@ lldb-command:v padding_at_end -//@ lldb-check:[...] { x = -10014 y = 10015 } +//@ lldb-check:[...] {x:-10014, y:10015} #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index e5fa8412af8a1..8b7ceb0c7aa29 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -21,28 +21,28 @@ //@ lldb-command:run //@ lldb-command:v three_simple_structs -//@ lldb-check:[...] { x = { x = 1 } y = { x = 2 } z = { x = 3 } } +//@ lldb-check:[...] {x:{x:1}, y:{x:2}, z:{x:3}} //@ lldb-command:v internal_padding_parent -//@ lldb-check:[...] { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } +//@ lldb-check:[...] {x:{x:4, y:5}, y:{x:6, y:7}, z:{x:8, y:9}} //@ lldb-command:v padding_at_end_parent -//@ lldb-check:[...] { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } +//@ lldb-check:[...] {x:{x:10, y:11}, y:{x:12, y:13}, z:{x:14, y:15}} //@ lldb-command:v mixed -//@ lldb-check:[...] { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } +//@ lldb-check:[...] {x:{x:16, y:17}, y:{x:18, y:19}, z:{x:20}, w:21} //@ lldb-command:v bag -//@ lldb-check:[...] { x = { x = 22 } } +//@ lldb-check:[...] {x:{x:22}} //@ lldb-command:v bag_in_bag -//@ lldb-check:[...] { x = { x = { x = 23 } } } +//@ lldb-check:[...] {x:{x:{x:23}}} //@ lldb-command:v tjo -//@ lldb-check:[...] { x = { x = { x = { x = 24 } } } } +//@ lldb-check:[...] {x:{x:{x:{x:24}}}} //@ lldb-command:v tree -//@ lldb-check:[...] { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } +//@ lldb-check:[...] {x:{x:25}, y:{x:{x:26, y:27}, y:{x:28, y:29}, z:{x:30, y:31}}, z:{x:{x:{x:32}}}} #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index a27ac14b369f5..a0ada74bc2f8f 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -22,16 +22,16 @@ //@ lldb-command:run //@ lldb-command:v simple -//@ lldb-check:[...] { x = 10 y = 20 } +//@ lldb-check:[...] {x:10, y:20} //@ lldb-command:v noDestructor -//@ lldb-check:[...] { a = { x = 10 y = 20 } guard = -1 } +//@ lldb-check:[...] {a:{x:10, y:20}, guard:-1} //@ lldb-command:v withDestructor -//@ lldb-check:[...] { a = { x = 10 y = 20 } guard = -1 } +//@ lldb-check:[...] {a:{x:10, y:20}, guard:-1} //@ lldb-command:v nested -//@ lldb-check:[...] { a = { a = { x = 7890 y = 9870 } } } +//@ lldb-check:[...] {a:{a:{x:7890, y:9870}}} #![allow(unused_variables)] diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index 9992732b82080..2f06ae4fd9ff7 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -30,22 +30,22 @@ //@ lldb-command:run //@ lldb-command:v no_padding16 -//@ lldb-check:[...] { 0 = 10000 1 = -10001 } +//@ lldb-check:[...] {0:10000, 1:-10001} //@ lldb-command:v no_padding32 -//@ lldb-check:[...] { 0 = -10002 1 = -10003.5 2 = 10004 } +//@ lldb-check:[...] {0:-10002, 1:-10003.5, 2:10004} //@ lldb-command:v no_padding64 -//@ lldb-check:[...] { 0 = -10005.5 1 = 10006 2 = 10007 } +//@ lldb-check:[...] {0:-10005.5, 1:10006, 2:10007} //@ lldb-command:v no_padding163264 -//@ lldb-check:[...] { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } +//@ lldb-check:[...] {0:-10008, 1:10009, 2:10010, 3:10011} //@ lldb-command:v internal_padding -//@ lldb-check:[...] { 0 = 10012 1 = -10013 } +//@ lldb-check:[...] {0:10012, 1:-10013} //@ lldb-command:v padding_at_end -//@ lldb-check:[...] { 0 = -10014 1 = 10015 } +//@ lldb-check:[...] {0:-10014, 1:10015} // This test case mainly makes sure that no field names are generated for tuple structs (as opposed // to all fields having the name ""). Otherwise they are handled the same a normal diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index 9934a32914417..bced679086144 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -14,10 +14,10 @@ //@ lldb-command:run //@ lldb-command:v u -//@ lldb-check:[...] { a = ('\x02', '\x02') b = 514 } +//@ lldb-check:[...] {a:('\x02', '\x02'), b:514} //@ lldb-command:print union_smoke::SU -//@ lldb-check:[...] { a = ('\x01', '\x01') b = 257 } +//@ lldb-check:[...] {a:('\x01', '\x01'), b:257} #![allow(unused)] diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 0fdc6dfc7220a..aa3eec8950314 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -44,9 +44,9 @@ //@ lldb-command:v constant //@ lldb-check:[...] 2 //@ lldb-command:v a_struct -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *struct_ref -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *owned //@ lldb-check:[...] 6 //@ lldb-command:v closure_local @@ -58,9 +58,9 @@ //@ lldb-command:v constant //@ lldb-check:[...] 2 //@ lldb-command:v a_struct -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *struct_ref -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *owned //@ lldb-check:[...] 6 //@ lldb-command:v closure_local diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index a52e1be482af2..945c7b924d93c 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -25,7 +25,7 @@ //@ lldb-command:v constant //@ lldb-check:[...] 1 //@ lldb-command:v a_struct -//@ lldb-check:[...] { a = -2 b = 3.5 c = 4 } +//@ lldb-check:[...] {a:-2, b:3.5, c:4} //@ lldb-command:v *owned //@ lldb-check:[...] 5 diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index 31cf0283c37b3..0a79d3b96eef8 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -40,9 +40,9 @@ //@ lldb-command:v constant //@ lldb-check:[...] 2 //@ lldb-command:v a_struct -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *struct_ref -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *owned //@ lldb-check:[...] 6 @@ -53,9 +53,9 @@ //@ lldb-command:v constant //@ lldb-check:[...] 2 //@ lldb-command:v a_struct -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *struct_ref -//@ lldb-check:[...] { a = -3 b = 4.5 c = 5 } +//@ lldb-check:[...] {a:-3, b:4.5, c:5} //@ lldb-command:v *owned //@ lldb-check:[...] 6 diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index ad31ca8fff2f5..b5e626854ae3c 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -70,7 +70,7 @@ //@ lldb-check:[...] size=2 { [0] = (6, 7) [1] = (8, 9) } //@ lldb-command:v padded_struct -//@ lldb-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } +//@ lldb-check:[...] size=2 { [0] = {x:10, y:11, z:12} [1] = {x:13, y:14, z:15} } #![allow(dead_code, unused_variables)] diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 375ec156df58b..2d6162e0f3654 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -15,7 +15,7 @@ //@ lldb-command:run //@ lldb-command:v a -//@ lldb-check:[...] { [0] = 1 [1] = 2 [2] = 3 } +//@ lldb-check:[...] ([0] = 1, [1] = 2, [2] = 3) #![allow(unused_variables)]