From 40198c772c5b8451d33a8cbf9125b913a6621cd1 Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Wed, 15 Apr 2026 07:08:29 -0500 Subject: [PATCH] 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 | 362 +++++++++++++++++- src/etc/lldb_providers.py | 105 ++--- src/etc/rust-lldb | 3 +- .../compiletest/src/runtest/debuginfo.rs | 6 +- 6 files changed, 412 insertions(+), 151 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..9cbde8633b94b 100644 --- a/src/etc/lldb_lookup.py +++ b/src/etc/lldb_lookup.py @@ -1,10 +1,43 @@ 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 ( + LLDBVersion, + DBG_VERSION, + 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, + MSVCEnumSyntheticProvider, + MSVCEnumSummaryProvider, + TupleSummaryProvider, + MSVCTupleSyntheticProvider, + ClangEncodedEnumSummaryProvider, +) from rust_types import ( ENUM_DISR_FIELD_NAME, ENUM_LLDB_ENCODED_VARIANTS, @@ -13,6 +46,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 +67,312 @@ # (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.eTypeOptionSkipPointers + # | lldb.eTypeOptionSkipReferences + | 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) + + version_str: str = debugger.version + + if version_str.startswith("lldb version "): + # e.g. "lldb version 22.1.2 (https://github.com/llvm/llvm-project revision + # 1ab49a973e210e97d61e5 db6557180dcb92c3e98)\n clang revision + # 1ab49a973e210e97d61e5db6557180dcb92c3e98\n llvm revision + # 1ab49a973e210e97d61e5db6557180dcb92c3e98" + + # this sould lop off the front and back, leaving us with only the 'x.x.x' + version_str: str = version_str.removeprefix("lldb version ").split(" ", 1)[0] + + major, minor, patch = version_str.split(".", 3) + + if not patch.isdigit(): + i = 0 + while i < len(patch) and patch[i].isdigit(): + i += 1 + patch = patch[:i] + elif version_str.startswith("lldb-"): + # FIXME: apple uses custom lldb. Their versioning seems to not directly correspond to LLVM's + # at some point it'll be worth adding in explicit tests for features rather than version + # checks. + major, minor, patch = 100, 0, 0 + + global DBG_VERSION + DBG_VERSION = LLDBVersion(int(major), int(minor), int(patch)) + + 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 DBG_VERSION.has_type_recognizers(): + # 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 + not_primitive.__name__, + lldb.eFormatterMatchCallback, + ), + lldb.eTypeOptionCascade, + ) + 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( + StdNonZeroNumberSummaryProvider, + 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 +398,10 @@ def arc_synthetic(valobj: lldb.SBValue, _dict: LLDBOpaque) -> object: return StdRcSyntheticProvider(valobj, _dict, is_atomic=True) +def not_primitive(type: lldb.SBType, _dict: LLDBOpaque) -> bool: + return type.GetBasicType() == lldb.eBasicTypeInvalid + + def classify_rust_type(type: lldb.SBType, is_msvc: bool) -> RustType: if type.IsPointerType(): return RustType.Indirection @@ -133,16 +479,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( + global RUST_CATEOGRY + RUST_CATEGORY.AddTypeSummary( lldb.SBTypeNameSpecifier(valobj.GetTypeName()), lldb.SBTypeSummary().CreateWithFunctionName( - "lldb_lookup.ClangEncodedEnumSummaryProvider" + MOD_PREFIX + ClangEncodedEnumSummaryProvider.__name__ ), ) return ClangEncodedEnumProvider(valobj, _dict) - if rust_type == RustType.Indirection: - return IndirectionSyntheticProvider(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 407e87cdf785b..66e741bc97d63 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -53,6 +53,46 @@ PY3 = sys.version_info[0] == 3 +class LLDBVersion: + __slots__ = ("major", "minor", "patch") + + def __init__(self, major: int, minor: int = 0, patch: int = 0): + self.major = major + self.minor = minor + self.patch = patch + + def __gte__(self, other: LLDBVersion): + return self.at_least(other.major, other.minor, other.patch) + + def at_least(self, major: int, minor: int = 0, patch: int = 0): + if self.major < major: + return False + + if self.major > major: + return True + + if self.minor < minor: + return False + + if self.minor > minor: + return True + + if self.patch < patch: + return False + + if self.patch >= patch: + return True + + def has_static_field_access(self) -> bool: + return self.major >= 18 + + def has_type_recognizers(self) -> bool: + return self.major >= 19 + + +DBG_VERSION: LLDBVersion = LLDBVersion(0, 0, 0) + + class LLDBOpaque: """ An marker type for use in type hints to denote LLDB bookkeeping variables. Values marked with @@ -70,14 +110,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) @@ -125,33 +169,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 self.is_ptr and name == "$$dereference$$": - return 0 - return -1 - - def get_child_at_index(self, index: int) -> SBValue: - if index == 0: - return self.valobj.Dereference().GetSyntheticValue() - 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() @@ -233,8 +250,6 @@ def resolve_msvc_template_arg(arg_name: str, target: SBTarget) -> SBType: return result.GetPointerType() if arg_name.startswith("array$<"): - arg_name = arg_name[7:-1].strip() - template_args = get_template_args(arg_name) element_name = next(template_args) @@ -622,6 +637,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): @@ -653,9 +672,7 @@ def update(self): ).GetValueAsUnsigned() if tag == discr: self.variant = child - self.value = child.GetChildMemberWithName( - "value" - ).GetSyntheticValue() + self.value = child.GetChildMemberWithName("value") return else: # if invalid, DISCR must be a range begin: int = ( @@ -673,16 +690,12 @@ def update(self): if begin < end: if begin <= tag <= end: self.variant = child - self.value = child.GetChildMemberWithName( - "value" - ).GetSyntheticValue() + self.value = child.GetChildMemberWithName("value") return else: if tag >= begin or tag <= end: self.variant = child - self.value = child.GetChildMemberWithName( - "value" - ).GetSyntheticValue() + self.value = child.GetChildMemberWithName("value") return else: # if invalid, tag is a 128 bit value tag_lo: int = self.valobj.GetChildMemberWithName( @@ -716,9 +729,7 @@ def update(self): discr: int = (exact_hi << 64) | exact_lo if tag == discr: self.variant = child - self.value = child.GetChildMemberWithName( - "value" - ).GetSyntheticValue() + self.value = child.GetChildMemberWithName("value") return else: # if invalid, DISCR must be a range begin_lo: int = ( @@ -750,16 +761,12 @@ def update(self): if begin < end: if begin <= tag <= end: self.variant = child - self.value = child.GetChildMemberWithName( - "value" - ).GetSyntheticValue() + self.value = child.GetChildMemberWithName("value") return else: if tag >= begin or tag <= end: self.variant = child - self.value = child.GetChildMemberWithName( - "value" - ).GetSyntheticValue() + self.value = child.GetChildMemberWithName("value") return def num_children(self) -> int: 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();