Skip to content

Commit

Permalink
Add debuginfo tests for collapse_debuginfo for statics.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Jun 13, 2024
1 parent 9c25d40 commit b89a0a7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/debuginfo/collapse-debuginfo-static-external.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//@ ignore-lldb

// Test that static debug info is not collapsed with #[collapse_debuginfo(external)]

//@ compile-flags:-g

// === GDB TESTS ===================================================================================

// gdb-command:info line collapse_debuginfo_static_external::FOO
// gdb-check:[...]Line 15[...]

#[collapse_debuginfo(external)]
macro_rules! decl_foo {
() => {
static FOO: u32 = 0;
};
}

decl_foo!();

fn main() {
// prevent FOO from getting optimized out
std::hint::black_box(&FOO);
}
24 changes: 24 additions & 0 deletions tests/debuginfo/collapse-debuginfo-static.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//@ ignore-lldb

// Test that static debug info is collapsed with #[collapse_debuginfo(yes)]

//@ compile-flags:-g

// === GDB TESTS ===================================================================================

// gdb-command:info line collapse_debuginfo_static::FOO
// gdb-check:[...]Line 19[...]

#[collapse_debuginfo(yes)]
macro_rules! decl_foo {
() => {
static FOO: u32 = 0;
};
}

decl_foo!();

fn main() {
// prevent FOO from getting optimized out
std::hint::black_box(&FOO);
}

0 comments on commit b89a0a7

Please sign in to comment.