summaryrefslogtreecommitdiffstats
path: root/tests/run-make-fulldeps/split-debuginfo
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /tests/run-make-fulldeps/split-debuginfo
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make-fulldeps/split-debuginfo')
-rw-r--r--tests/run-make-fulldeps/split-debuginfo/Makefile308
-rw-r--r--tests/run-make-fulldeps/split-debuginfo/bar.rs13
-rw-r--r--tests/run-make-fulldeps/split-debuginfo/baz.rs1
-rw-r--r--tests/run-make-fulldeps/split-debuginfo/foo.rs15
-rw-r--r--tests/run-make-fulldeps/split-debuginfo/main.rs8
5 files changed, 345 insertions, 0 deletions
diff --git a/tests/run-make-fulldeps/split-debuginfo/Makefile b/tests/run-make-fulldeps/split-debuginfo/Makefile
new file mode 100644
index 000000000..1831ab38f
--- /dev/null
+++ b/tests/run-make-fulldeps/split-debuginfo/Makefile
@@ -0,0 +1,308 @@
+include ../tools.mk
+
+all: off packed unpacked
+
+ifeq ($(UNAME),Darwin)
+# If disabled, don't run `dsymutil`.
+off:
+ rm -rf $(TMPDIR)/*.dSYM
+ $(RUSTC) foo.rs -g -C split-debuginfo=off
+ [ ! -d $(TMPDIR)/foo.dSYM ]
+
+# Packed by default, but only if debuginfo is requested
+packed:
+ rm -rf $(TMPDIR)/*.dSYM
+ $(RUSTC) foo.rs
+ [ ! -d $(TMPDIR)/foo.dSYM ]
+ rm -rf $(TMPDIR)/*.dSYM
+ $(RUSTC) foo.rs -g
+ [ -d $(TMPDIR)/foo.dSYM ]
+ rm -rf $(TMPDIR)/*.dSYM
+ $(RUSTC) foo.rs -g -C split-debuginfo=packed
+ [ -d $(TMPDIR)/foo.dSYM ]
+ rm -rf $(TMPDIR)/*.dSYM
+
+# Object files are preserved with unpacked and `dsymutil` isn't run
+unpacked:
+ $(RUSTC) foo.rs -g -C split-debuginfo=unpacked
+ ls $(TMPDIR)/*.o
+ [ ! -d $(TMPDIR)/foo.dSYM ]
+else
+ifdef IS_WINDOWS
+# Windows only supports packed debuginfo - nothing to test.
+off:
+packed:
+unpacked:
+else
+# Some non-Windows, non-Darwin platforms are not stable, and some are.
+ifeq ($(UNAME),Linux)
+ UNSTABLEOPTS :=
+else
+ UNSTABLEOPTS := -Zunstable-options
+endif
+
+# - Debuginfo in `.o` files
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` never created
+off:
+ $(RUSTC) foo.rs -g -C $(UNSTABLEOPTS) split-debuginfo=off
+ [ ! -f $(TMPDIR)/*.dwp ]
+ [ ! -f $(TMPDIR)/*.dwo ]
+ $(RUSTC) foo.rs -g
+ [ ! -f $(TMPDIR)/*.dwp ]
+ [ ! -f $(TMPDIR)/*.dwo ]
+
+packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate
+
+# - Debuginfo in `.dwo` files
+# - `.o` deleted
+# - `.dwo` deleted
+# - `.dwp` present
+packed-split:
+ $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=split
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` present
+packed-single:
+ $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=single
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
+packed-lto: packed-lto-split packed-lto-single
+
+# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
+# - `.o` never created
+# - `.dwo` never created
+# - `.dwp` never created
+packed-lto-split:
+ $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \
+ --crate-type=rlib -Clinker-plugin-lto
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/libbaz.rlib
+
+# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
+# - `.o` never created
+# - `.dwo` never created
+# - `.dwp` never created
+packed-lto-single:
+ $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \
+ --crate-type=rlib -Clinker-plugin-lto
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/libbaz.rlib
+
+packed-remapped: packed-remapped-split packed-remapped-single
+
+# - Debuginfo in `.dwo` files
+# - `.o` and binary refer to remapped `.dwo` paths which do not exist
+# - `.o` deleted
+# - `.dwo` deleted
+# - `.dwp` present
+packed-remapped-split:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
+ -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` present
+packed-remapped-single:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
+packed-crosscrate: packed-crosscrate-split packed-crosscrate-single
+
+# - Debuginfo in `.dwo` files
+# - (bar) `.rlib` file created, contains `.dwo`
+# - (bar) `.o` deleted
+# - (bar) `.dwo` deleted
+# - (bar) `.dwp` never created
+# - (main) `.o` deleted
+# - (main) `.dwo` deleted
+# - (main) `.dwp` present
+packed-crosscrate-split:
+ $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \
+ -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs
+ ls $(TMPDIR)/*.rlib
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \
+ -C split-debuginfo=packed -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/main.dwp
+ rm $(TMPDIR)/$(call BIN,main)
+
+# - Debuginfo in `.o` files
+# - (bar) `.rlib` file created, contains `.o`
+# - (bar) `.o` deleted
+# - (bar) `.dwo` never created
+# - (bar) `.dwp` never created
+# - (main) `.o` deleted
+# - (main) `.dwo` never created
+# - (main) `.dwp` present
+packed-crosscrate-single:
+ $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \
+ -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs
+ ls $(TMPDIR)/*.rlib
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \
+ -C split-debuginfo=packed -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/main.dwp
+ rm $(TMPDIR)/$(call BIN,main)
+
+unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate
+
+# - Debuginfo in `.dwo` files
+# - `.o` deleted
+# - `.dwo` present
+# - `.dwp` never created
+unpacked-split:
+ $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ rm $(TMPDIR)/*.dwo
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` present
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-single:
+ $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single
+ ls $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
+unpacked-lto: packed-lto-split packed-lto-single
+
+# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
+# - `.o` never created
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-lto-split:
+ $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \
+ --crate-type=rlib -Clinker-plugin-lto
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/libbaz.rlib
+
+# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
+# - `.o` never created
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-lto-single:
+ $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \
+ --crate-type=rlib -Clinker-plugin-lto
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/libbaz.rlib
+
+unpacked-remapped: unpacked-remapped-split unpacked-remapped-single
+
+# - Debuginfo in `.dwo` files
+# - `.o` and binary refer to remapped `.dwo` paths which do not exist
+# - `.o` deleted
+# - `.dwo` present
+# - `.dwp` never created
+unpacked-remapped-split:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
+ -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ rm $(TMPDIR)/*.dwo
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` present
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-remapped-single:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
+unpacked-crosscrate: packed-crosscrate-split packed-crosscrate-single
+
+# - Debuginfo in `.dwo` files
+# - (bar) `.rlib` file created, contains `.dwo`
+# - (bar) `.o` deleted
+# - (bar) `.dwo` present
+# - (bar) `.dwp` never created
+# - (main) `.o` deleted
+# - (main) `.dwo` present
+# - (main) `.dwp` never created
+unpacked-crosscrate-split:
+ $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \
+ -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs
+ ls $(TMPDIR)/*.rlib
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \
+ -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ rm $(TMPDIR)/*.dwo
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,main)
+
+# - Debuginfo in `.o` files
+# - (bar) `.rlib` file created, contains `.o`
+# - (bar) `.o` present
+# - (bar) `.dwo` never created
+# - (bar) `.dwp` never created
+# - (main) `.o` present
+# - (main) `.dwo` never created
+# - (main) `.dwp` never created
+unpacked-crosscrate-single:
+ $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \
+ -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs
+ ls $(TMPDIR)/*.rlib
+ ls $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \
+ -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs
+ ls $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,main)
+endif
+endif
diff --git a/tests/run-make-fulldeps/split-debuginfo/bar.rs b/tests/run-make-fulldeps/split-debuginfo/bar.rs
new file mode 100644
index 000000000..07dd07152
--- /dev/null
+++ b/tests/run-make-fulldeps/split-debuginfo/bar.rs
@@ -0,0 +1,13 @@
+pub struct Bar {
+ x: u32,
+}
+
+impl Bar {
+ pub fn print(&self) {
+ println!("{}", self.x);
+ }
+}
+
+pub fn make_bar(x: u32) -> Bar {
+ Bar { x }
+}
diff --git a/tests/run-make-fulldeps/split-debuginfo/baz.rs b/tests/run-make-fulldeps/split-debuginfo/baz.rs
new file mode 100644
index 000000000..8b1a39374
--- /dev/null
+++ b/tests/run-make-fulldeps/split-debuginfo/baz.rs
@@ -0,0 +1 @@
+// empty
diff --git a/tests/run-make-fulldeps/split-debuginfo/foo.rs b/tests/run-make-fulldeps/split-debuginfo/foo.rs
new file mode 100644
index 000000000..b058e5408
--- /dev/null
+++ b/tests/run-make-fulldeps/split-debuginfo/foo.rs
@@ -0,0 +1,15 @@
+pub struct Foo {
+ x: u32,
+}
+
+impl Foo {
+ pub fn print(&self) {
+ println!("{}", self.x);
+ }
+}
+
+pub fn make_foo(x: u32) -> Foo {
+ Foo { x }
+}
+
+fn main() {}
diff --git a/tests/run-make-fulldeps/split-debuginfo/main.rs b/tests/run-make-fulldeps/split-debuginfo/main.rs
new file mode 100644
index 000000000..21fa16e40
--- /dev/null
+++ b/tests/run-make-fulldeps/split-debuginfo/main.rs
@@ -0,0 +1,8 @@
+extern crate bar;
+
+use bar::{Bar, make_bar};
+
+fn main() {
+ let b = make_bar(3);
+ b.print();
+}