rust/tests/debuginfo/no_mangle-info.rs
Martin Nordholts 5b57d02e9f compiletest: Use //@ prefixes also for debuginfo test directives
So that when we later add support for revisions we can use the same
syntax for revisions as elsewhere.

This also prevents people from making typos for commands since
`src/tools/compiletest/src/directives/directive_names.rs` will catch such
typos now.

Note that we one FIXME for a non-trivial change for later:
```
// FIXME(148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```
2025-11-25 06:13:45 +01:00

41 lines
1.6 KiB
Rust

//@ compile-flags:-g
//@ min-gdb-version: 10.1
//@ ignore-backends: gcc
// === GDB TESTS ===================================================================================
//@ gdb-command:run
//@ gdb-command:p TEST
//@ gdb-check:$1 = 3735928559
//@ gdb-command:p no_mangle_info::namespace::OTHER_TEST
//@ gdb-check:$2 = 42
// === LLDB TESTS ==================================================================================
//@ lldb-command:run
//@ lldb-command:v TEST
//@ lldb-check:(unsigned long) TEST = 3735928559
//@ lldb-command:v OTHER_TEST
//@ lldb-check:(unsigned long) no_mangle_info::namespace::OTHER_TEST = 42
// === CDB TESTS ==================================================================================
//@ cdb-command: g
// Note: LLDB and GDB allow referring to items that are in the same namespace of the symbol
// we currently have a breakpoint on in an unqualified way. CDB does not, and thus we need to
// refer to it in a fully qualified way.
//@ cdb-command: dx a!no_mangle_info::TEST
//@ cdb-check: a!no_mangle_info::TEST : 0xdeadbeef [Type: unsigned __int64]
//@ cdb-command: dx a!no_mangle_info::namespace::OTHER_TEST
//@ cdb-check: a!no_mangle_info::namespace::OTHER_TEST : 0x2a [Type: unsigned __int64]
#[no_mangle]
pub static TEST: u64 = 0xdeadbeef;
// FIXME(rylev, wesleywiser): uncommenting this item breaks the test, and we're not sure why
// pub static OTHER_TEST: u64 = 43;
pub mod namespace {
pub static OTHER_TEST: u64 = 42;
}
pub fn main() {
println!("TEST: {}", TEST);
println!("OTHER TEST: {}", namespace::OTHER_TEST); // #break
}