Skip to content

Commit 42af197

Browse files
committed
Improve debuginfo test coverage for simple statics.
- Re-enabled basic-types-globals which has been disabled since 2018 - Updated its now-rotted assertions about GDB's output to pass - Rewrote header comment describing some previous state of GDB behavior that didn't match either the checked-in assertions _or_ the current behavior, and so I assume has just been wrong for some time. - Copy-pasta'd the test into a version that uses LTO to check for regression on #90357, because I don't see a way to matrix the same test into several build configurations.
1 parent 98190b7 commit 42af197

File tree

2 files changed

+83
-7
lines changed

2 files changed

+83
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Caveat - gdb doesn't know about UTF-32 character encoding and will print a
2+
// rust char as only its numerical value.
3+
4+
// min-lldb-version: 310
5+
6+
// no-prefer-dynamic
7+
// compile-flags:-g -C lto
8+
// gdb-command:run
9+
// gdbg-command:print 'basic_types_globals::B'
10+
// gdbr-command:print B
11+
// gdb-check:$1 = false
12+
// gdbg-command:print 'basic_types_globals::I'
13+
// gdbr-command:print I
14+
// gdb-check:$2 = -1
15+
// gdbg-command:print 'basic_types_globals::C'
16+
// gdbr-command:print C
17+
// gdbg-check:$3 = 97
18+
// gdbr-check:$3 = 97
19+
// gdbg-command:print/d 'basic_types_globals::I8'
20+
// gdbr-command:print I8
21+
// gdb-check:$4 = 68
22+
// gdbg-command:print 'basic_types_globals::I16'
23+
// gdbr-command:print I16
24+
// gdb-check:$5 = -16
25+
// gdbg-command:print 'basic_types_globals::I32'
26+
// gdbr-command:print I32
27+
// gdb-check:$6 = -32
28+
// gdbg-command:print 'basic_types_globals::I64'
29+
// gdbr-command:print I64
30+
// gdb-check:$7 = -64
31+
// gdbg-command:print 'basic_types_globals::U'
32+
// gdbr-command:print U
33+
// gdb-check:$8 = 1
34+
// gdbg-command:print/d 'basic_types_globals::U8'
35+
// gdbr-command:print U8
36+
// gdb-check:$9 = 100
37+
// gdbg-command:print 'basic_types_globals::U16'
38+
// gdbr-command:print U16
39+
// gdb-check:$10 = 16
40+
// gdbg-command:print 'basic_types_globals::U32'
41+
// gdbr-command:print U32
42+
// gdb-check:$11 = 32
43+
// gdbg-command:print 'basic_types_globals::U64'
44+
// gdbr-command:print U64
45+
// gdb-check:$12 = 64
46+
// gdbg-command:print 'basic_types_globals::F32'
47+
// gdbr-command:print F32
48+
// gdb-check:$13 = 2.5
49+
// gdbg-command:print 'basic_types_globals::F64'
50+
// gdbr-command:print F64
51+
// gdb-check:$14 = 3.5
52+
// gdb-command:continue
53+
54+
#![allow(unused_variables)]
55+
#![feature(omit_gdb_pretty_printer_section)]
56+
#![omit_gdb_pretty_printer_section]
57+
58+
// N.B. These are `mut` only so they don't constant fold away.
59+
static mut B: bool = false;
60+
static mut I: isize = -1;
61+
static mut C: char = 'a';
62+
static mut I8: i8 = 68;
63+
static mut I16: i16 = -16;
64+
static mut I32: i32 = -32;
65+
static mut I64: i64 = -64;
66+
static mut U: usize = 1;
67+
static mut U8: u8 = 100;
68+
static mut U16: u16 = 16;
69+
static mut U32: u32 = 32;
70+
static mut U64: u64 = 64;
71+
static mut F32: f32 = 2.5;
72+
static mut F64: f64 = 3.5;
73+
74+
fn main() {
75+
_zzz(); // #break
76+
77+
let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) };
78+
}
79+
80+
fn _zzz() {()}

src/test/debuginfo/basic-types-globals.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
2-
// as its numerical value along with its associated ASCII char, there
3-
// doesn't seem to be any way around this. Also, gdb doesn't know
4-
// about UTF-32 character encoding and will print a rust char as only
5-
// its numerical value.
1+
// Caveat - gdb doesn't know about UTF-32 character encoding and will print a
2+
// rust char as only its numerical value.
63

74
// min-lldb-version: 310
8-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
95

106
// compile-flags:-g
117
// gdb-command:run
@@ -18,7 +14,7 @@
1814
// gdbg-command:print 'basic_types_globals::C'
1915
// gdbr-command:print C
2016
// gdbg-check:$3 = 97
21-
// gdbr-check:$3 = 97 'a'
17+
// gdbr-check:$3 = 97
2218
// gdbg-command:print/d 'basic_types_globals::I8'
2319
// gdbr-command:print I8
2420
// gdb-check:$4 = 68

0 commit comments

Comments
 (0)