Skip to content

Commit 4463c58

Browse files
committed
fix tests
1 parent 58c5266 commit 4463c58

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/etc/lldb_lookup.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,18 @@ def classify_rust_type(type: lldb.SBType, is_msvc: bool) -> RustType:
9191

9292
def synthetic_lookup(valobj: lldb.SBValue, _dict: LLDBOpaque) -> object:
9393
"""Returns the synthetic provider for the given value"""
94-
is_msvc = valobj.GetTarget().GetTriple().endswith("msvc")
94+
95+
# small hack to check for the DWARF debug info section, since SBTarget.triple and
96+
# SBProcess.triple report lldb's target rather than the executable's. SBProcessInfo.triple
97+
# returns a triple without the ABI. It is also possible for any of those functions to return a
98+
# None object.
99+
# Instead, we look for the GNU `.debug_info` section, as MSVC does not have one with the same
100+
# name
101+
# FIXME: I don't know if this works when the DWARF lives in a separate file
102+
# (see: https://gcc.gnu.org/wiki/DebugFissionDWP). Splitting the DWARF is very uncommon afaik so
103+
# it should be okay for the time being.
104+
is_msvc = not valobj.GetFrame().GetModule().FindSection(".debug_info").IsValid()
105+
95106
rust_type = classify_rust_type(valobj.GetType(), is_msvc)
96107

97108
if rust_type == RustType.Struct or rust_type == RustType.Union:

tests/debuginfo/numeric-types.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,40 +211,40 @@
211211
//@ lldb-command:run
212212

213213
//@ lldb-command:v/d nz_i8
214-
//@ lldb-check:[...] 11 { __0 = { 0 = 11 } }
214+
//@ lldb-check:[...] 11 { 0 = { 0 = 11 } }
215215

216216
//@ lldb-command:v nz_i16
217-
//@ lldb-check:[...] 22 { __0 = { 0 = 22 } }
217+
//@ lldb-check:[...] 22 { 0 = { 0 = 22 } }
218218

219219
//@ lldb-command:v nz_i32
220-
//@ lldb-check:[...] 33 { __0 = { 0 = 33 } }
220+
//@ lldb-check:[...] 33 { 0 = { 0 = 33 } }
221221

222222
//@ lldb-command:v nz_i64
223-
//@ lldb-check:[...] 44 { __0 = { 0 = 44 } }
223+
//@ lldb-check:[...] 44 { 0 = { 0 = 44 } }
224224

225225
//@ lldb-command:v nz_i128
226-
//@ lldb-check:[...] 55 { __0 = { 0 = 55 } }
226+
//@ lldb-check:[...] 55 { 0 = { 0 = 55 } }
227227

228228
//@ lldb-command:v nz_isize
229-
//@ lldb-check:[...] 66 { __0 = { 0 = 66 } }
229+
//@ lldb-check:[...] 66 { 0 = { 0 = 66 } }
230230

231231
//@ lldb-command:v/d nz_u8
232-
//@ lldb-check:[...] 77 { __0 = { 0 = 77 } }
232+
//@ lldb-check:[...] 77 { 0 = { 0 = 77 } }
233233

234234
//@ lldb-command:v nz_u16
235-
//@ lldb-check:[...] 88 { __0 = { 0 = 88 } }
235+
//@ lldb-check:[...] 88 { 0 = { 0 = 88 } }
236236

237237
//@ lldb-command:v nz_u32
238-
//@ lldb-check:[...] 99 { __0 = { 0 = 99 } }
238+
//@ lldb-check:[...] 99 { 0 = { 0 = 99 } }
239239

240240
//@ lldb-command:v nz_u64
241-
//@ lldb-check:[...] 100 { __0 = { 0 = 100 } }
241+
//@ lldb-check:[...] 100 { 0 = { 0 = 100 } }
242242

243243
//@ lldb-command:v nz_u128
244-
//@ lldb-check:[...] 111 { __0 = { 0 = 111 } }
244+
//@ lldb-check:[...] 111 { 0 = { 0 = 111 } }
245245

246246
//@ lldb-command:v nz_usize
247-
//@ lldb-check:[...] 122 { __0 = { 0 = 122 } }
247+
//@ lldb-check:[...] 122 { 0 = { 0 = 122 } }
248248

249249
use std::num::*;
250250
use std::sync::atomic::*;

0 commit comments

Comments
 (0)