about summary refs log tree commit diff
path: root/tests/debuginfo
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-19 08:42:17 +0000
committerbors <bors@rust-lang.org>2024-01-19 08:42:17 +0000
commit92d727796be7c882d2efbc06e08bbf4743cf29dc (patch)
treedfa01ef8715c67165d86640add0cdd9f89aa8a18 /tests/debuginfo
parent16fadb3f252bcfc5ee3f0be09472c9600a052202 (diff)
parent9c6795baab8bc343c8573ea4ea4c2b550f6bc0ac (diff)
downloadrust-92d727796be7c882d2efbc06e08bbf4743cf29dc.tar.gz
rust-92d727796be7c882d2efbc06e08bbf4743cf29dc.zip
Auto merge of #120112 - matthiaskrgr:rollup-48o3919, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #119582 (bootstrap: handle vendored sources when remapping crate paths)
 - #119730 (docs: fix typos)
 - #119828 (Improved collapse_debuginfo attribute, added command-line flag)
 - #119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`)
 - #120037 (Remove `next_root_ty_var`)
 - #120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18)
 - #120096 (Set RUSTC_BOOTSTRAP=1 consistently)
 - #120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned)
 - #120102 (Fix typo in munmap_partial.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/debuginfo')
-rw-r--r--tests/debuginfo/collapse-debuginfo-external-attr.rs31
-rw-r--r--tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs34
-rw-r--r--tests/debuginfo/collapse-debuginfo-external-flag.rs26
-rw-r--r--tests/debuginfo/collapse-debuginfo-no-attr.rs2
-rw-r--r--tests/debuginfo/collapse-debuginfo-with-yes-flag.rs57
5 files changed, 149 insertions, 1 deletions
diff --git a/tests/debuginfo/collapse-debuginfo-external-attr.rs b/tests/debuginfo/collapse-debuginfo-external-attr.rs
new file mode 100644
index 00000000000..f36b0833ad5
--- /dev/null
+++ b/tests/debuginfo/collapse-debuginfo-external-attr.rs
@@ -0,0 +1,31 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that local macro debug info is not collapsed with #[collapse_debuginfo(external)]
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#one_callsite[...]
+// gdb-command:continue
+
+fn one() {
+    println!("one");
+}
+
+#[collapse_debuginfo(external)]
+macro_rules! outer {
+    () => {
+        one(); // #one_callsite
+    };
+}
+
+fn main() {
+    let ret = 0; // #break
+    outer!();
+    std::process::exit(ret);
+}
diff --git a/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs b/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs
new file mode 100644
index 00000000000..e5cbc1a685d
--- /dev/null
+++ b/tests/debuginfo/collapse-debuginfo-external-flag-overriden-by-attr.rs
@@ -0,0 +1,34 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that macro attribute #[collapse_debuginfo(no)]
+// overrides "collapse_macro_debuginfo=external" flag
+
+// compile-flags:-g -Z collapse_macro_debuginfo=external
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#one_callsite[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-command:continue
+
+fn one() {
+    println!("one");
+}
+
+#[collapse_debuginfo(no)]
+macro_rules! outer {
+    () => {
+        one(); // #one_callsite
+    };
+}
+
+fn main() {
+    let ret = 0; // #break
+    outer!();
+    std::process::exit(ret);
+}
diff --git a/tests/debuginfo/collapse-debuginfo-external-flag.rs b/tests/debuginfo/collapse-debuginfo-external-flag.rs
new file mode 100644
index 00000000000..9a0aef38ea6
--- /dev/null
+++ b/tests/debuginfo/collapse-debuginfo-external-flag.rs
@@ -0,0 +1,26 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that println macro debug info is collapsed with "collapse_macro_debuginfo=external" flag
+
+// compile-flags:-g -Z collapse_macro_debuginfo=external
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#println_callsite[...]
+// gdb-command:continue
+
+macro_rules! outer {
+    () => {
+        println!("one"); // #println_callsite
+    };
+}
+
+fn main() {
+    let ret = 0; // #break
+    outer!();
+    std::process::exit(ret);
+}
diff --git a/tests/debuginfo/collapse-debuginfo-no-attr.rs b/tests/debuginfo/collapse-debuginfo-no-attr.rs
index 230c8795be3..d156c381a15 100644
--- a/tests/debuginfo/collapse-debuginfo-no-attr.rs
+++ b/tests/debuginfo/collapse-debuginfo-no-attr.rs
@@ -4,7 +4,7 @@
 // Test that line numbers are not replaced with those of the outermost expansion site when the
 // `collapse_debuginfo` feature is active and the attribute is not provided.
 
-// compile-flags:-g
+// compile-flags:-g -Z collapse_macro_debuginfo=no
 
 // === GDB TESTS ===================================================================================
 
diff --git a/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs b/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs
new file mode 100644
index 00000000000..76a97a325d7
--- /dev/null
+++ b/tests/debuginfo/collapse-debuginfo-with-yes-flag.rs
@@ -0,0 +1,57 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that line numbers are replaced with those of the outermost expansion site when the
+// `collapse_debuginfo` feature is active and the command line flag is provided.
+
+// compile-flags:-g -Z collapse_macro_debuginfo=yes
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:continue
+
+fn one() {
+    println!("one");
+}
+fn two() {
+    println!("two");
+}
+fn three() {
+    println!("three");
+}
+fn four() {
+    println!("four");
+}
+
+macro_rules! outer {
+    ($b:block) => {
+        one();
+        inner!();
+        $b
+    };
+}
+
+macro_rules! inner {
+    () => {
+        two();
+    };
+}
+
+fn main() {
+    let ret = 0; // #break
+    outer!({ // #loc1
+        three(); // #loc2
+        four(); // #loc3
+    });
+    std::process::exit(ret);
+}