From eca09dedef8d8d94a099f800045b013570d7569a Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Sat, 15 Nov 2025 04:28:56 -0600 Subject: [PATCH] fix tests --- src/etc/lldb_lookup.py | 13 ++++++++++++- tests/debuginfo/numeric-types.rs | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/etc/lldb_lookup.py b/src/etc/lldb_lookup.py index 7f681e4a35fc..67194a09ec4c 100644 --- a/src/etc/lldb_lookup.py +++ b/src/etc/lldb_lookup.py @@ -91,7 +91,18 @@ def classify_rust_type(type: lldb.SBType, is_msvc: bool) -> RustType: def synthetic_lookup(valobj: lldb.SBValue, _dict: LLDBOpaque) -> object: """Returns the synthetic provider for the given value""" - is_msvc = valobj.GetTarget().GetTriple().endswith("msvc") + + # small hack to check for the DWARF debug info section, since SBTarget.triple and + # SBProcess.triple report lldb's target rather than the executable's. SBProcessInfo.triple + # returns a triple without the ABI. It is also possible for any of those functions to return a + # None object. + # Instead, we look for the GNU `.debug_info` section, as MSVC does not have one with the same + # name + # FIXME: I don't know if this works when the DWARF lives in a separate file + # (see: https://gcc.gnu.org/wiki/DebugFissionDWP). Splitting the DWARF is very uncommon afaik so + # it should be okay for the time being. + is_msvc = not valobj.GetFrame().GetModule().FindSection(".debug_info").IsValid() + rust_type = classify_rust_type(valobj.GetType(), is_msvc) if rust_type == RustType.Struct or rust_type == RustType.Union: diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index dbbc4ee6e861..a27102da9692 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -199,40 +199,40 @@ //@ lldb-command:run //@ lldb-command:v/d nz_i8 -//@ lldb-check:[...] 11 { __0 = { 0 = 11 } } +//@ lldb-check:[...] 11 { 0 = { 0 = 11 } } //@ lldb-command:v nz_i16 -//@ lldb-check:[...] 22 { __0 = { 0 = 22 } } +//@ lldb-check:[...] 22 { 0 = { 0 = 22 } } //@ lldb-command:v nz_i32 -//@ lldb-check:[...] 33 { __0 = { 0 = 33 } } +//@ lldb-check:[...] 33 { 0 = { 0 = 33 } } //@ lldb-command:v nz_i64 -//@ lldb-check:[...] 44 { __0 = { 0 = 44 } } +//@ lldb-check:[...] 44 { 0 = { 0 = 44 } } //@ lldb-command:v nz_i128 -//@ lldb-check:[...] 55 { __0 = { 0 = 55 } } +//@ lldb-check:[...] 55 { 0 = { 0 = 55 } } //@ lldb-command:v nz_isize -//@ lldb-check:[...] 66 { __0 = { 0 = 66 } } +//@ lldb-check:[...] 66 { 0 = { 0 = 66 } } //@ lldb-command:v/d nz_u8 -//@ lldb-check:[...] 77 { __0 = { 0 = 77 } } +//@ lldb-check:[...] 77 { 0 = { 0 = 77 } } //@ lldb-command:v nz_u16 -//@ lldb-check:[...] 88 { __0 = { 0 = 88 } } +//@ lldb-check:[...] 88 { 0 = { 0 = 88 } } //@ lldb-command:v nz_u32 -//@ lldb-check:[...] 99 { __0 = { 0 = 99 } } +//@ lldb-check:[...] 99 { 0 = { 0 = 99 } } //@ lldb-command:v nz_u64 -//@ lldb-check:[...] 100 { __0 = { 0 = 100 } } +//@ lldb-check:[...] 100 { 0 = { 0 = 100 } } //@ lldb-command:v nz_u128 -//@ lldb-check:[...] 111 { __0 = { 0 = 111 } } +//@ lldb-check:[...] 111 { 0 = { 0 = 111 } } //@ lldb-command:v nz_usize -//@ lldb-check:[...] 122 { __0 = { 0 = 122 } } +//@ lldb-check:[...] 122 { 0 = { 0 = 122 } } use std::num::*; use std::sync::atomic::*;