rust/tests/debuginfo/lexical-scope-with-macro.rs
Vadim Petrochenkov 98804c1786 debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo]
`-Z debug-macros` is "stabilized" by enabling it by default and removing.

`-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`.
It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no.

Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local).
`#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
2024-04-25 22:14:47 +03:00

178 lines
3.2 KiB
Rust

//@ min-lldb-version: 310
//@ ignore-lldb FIXME #48807
//@ compile-flags:-g
// === GDB TESTS ===================================================================================
// gdb-command:run
// gdb-command:print a
// gdb-check:$1 = 10
// gdb-command:print b
// gdb-check:$2 = 34
// gdb-command:continue
// gdb-command:print a
// gdb-check:$3 = 890242
// gdb-command:print b
// gdb-check:$4 = 34
// gdb-command:continue
// gdb-command:print a
// gdb-check:$5 = 10
// gdb-command:print b
// gdb-check:$6 = 34
// gdb-command:continue
// gdb-command:print a
// gdb-check:$7 = 102
// gdb-command:print b
// gdb-check:$8 = 34
// gdb-command:continue
// gdb-command:print a
// gdb-check:$9 = 110
// gdb-command:print b
// gdb-check:$10 = 34
// gdb-command:continue
// gdb-command:print a
// gdb-check:$11 = 10
// gdb-command:print b
// gdb-check:$12 = 34
// gdb-command:continue
// gdb-command:print a
// gdb-check:$13 = 10
// gdb-command:print b
// gdb-check:$14 = 34
// gdb-command:print c
// gdb-check:$15 = 400
// gdb-command:continue
// === LLDB TESTS ==================================================================================
// lldb-command:run
// lldb-command:v a
// lldbg-check:[...] 10
// lldbr-check:(i32) a = 10
// lldb-command:v b
// lldbg-check:[...] 34
// lldbr-check:(i32) b = 34
// lldb-command:continue
// lldb-command:v a
// lldbg-check:[...] 890242
// lldbr-check:(i32) a = 10
// lldb-command:v b
// lldbg-check:[...] 34
// lldbr-check:(i32) b = 34
// lldb-command:continue
// lldb-command:v a
// lldbg-check:[...] 10
// lldbr-check:(i32) a = 10
// lldb-command:v b
// lldbg-check:[...] 34
// lldbr-check:(i32) b = 34
// lldb-command:continue
// lldb-command:v a
// lldbg-check:[...] 102
// lldbr-check:(i32) a = 10
// lldb-command:v b
// lldbg-check:[...] 34
// lldbr-check:(i32) b = 34
// lldb-command:continue
// Don't test this with rust-enabled lldb for now; see issue #48807
// lldbg-command:print a
// lldbg-check:[...] 110
// lldbg-command:print b
// lldbg-check:[...] 34
// lldbg-command:continue
// lldbg-command:print a
// lldbg-check:[...] 10
// lldbg-command:print b
// lldbg-check:[...] 34
// lldbg-command:continue
// lldbg-command:print a
// lldbg-check:[...] 10
// lldbg-command:print b
// lldbg-check:[...] 34
// lldbg-command:print c
// lldbg-check:[...] 400
// lldbg-command:continue
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
macro_rules! trivial {
($e1:expr) => ($e1)
}
macro_rules! no_new_scope {
($e1:expr) => (($e1 + 2) - 1)
}
macro_rules! new_scope {
() => ({
let a = 890242;
zzz(); // #break
sentinel();
})
}
macro_rules! shadow_within_macro {
($e1:expr) => ({
let a = $e1 + 2;
zzz(); // #break
sentinel();
let a = $e1 + 10;
zzz(); // #break
sentinel();
})
}
macro_rules! dup_expr {
($e1:expr) => (($e1) + ($e1))
}
fn main() {
let a = trivial!(10);
let b = no_new_scope!(33);
zzz(); // #break
sentinel();
new_scope!();
zzz(); // #break
sentinel();
shadow_within_macro!(100);
zzz(); // #break
sentinel();
let c = dup_expr!(10 * 20);
zzz(); // #break
sentinel();
}
fn zzz() {()}
fn sentinel() {()}