Rollup merge of #135572 - jieyouxu:migrate-split-debuginfo, r=davidtwco
tests: Port `split-debuginfo` to rmake.rs Part of #121876. This PR supersedes #128754 and is co-authored with `@Oneirical.` ## Known limitations - In general, like the `Makefile` version, this test in its present form is also somewhat funny because for the most part it merely checks for existence/absence of output artifacts but makes no attempt to actually check if the debuginfo is at all usable. ## Changes This PR ports `tests/run-make/split-debuginfo` to rmake.rs. This is an **initial** port, and certainly could be cleaned up and/or enhanced. The original Makefile version had several functional problems. I fixed some of them, but also left some existing issues as-is. 1. The linux/non-linux final branch had a conditional interpolation of `UNSTABLE_OPTIONS := -Zunstable-options`. However, one of the use sites was `-C $(UNSTABLE_OPTIONS) split-debuginfo`. This indicates to me that this run-make test is not run in CI under a non-linux + non-windows + non-darwin environment, because that would've failed as this would expand to `-C -Zunstable-options split-debuginfo`. I fixed this in the rmake.rs version, but I'm not sure if this distinction is worth keeping at all if it's not tested in CI. 2. There are several comments that were discovered to be wrong. I tried to fix them in the rmake.rs version as well. 3. The check for path remapping / lack of path remapping through ```make objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 ``` is incorrect, because that looks at the single line of that contains `DW_AT_GNU_dwo_name`. This is unfortunately wrong because empirical evidence shows that with `objdump`[^objdump], the check actually needs to look at the attribute value of `DW_AT_comp_dir` on the previous line not `DW_AT_GNU_dwo_name`[^gnu-ext]. Example output of `objdump`: ```text <10> DW_AT_comp_dir : (indirect string, offset: 0xafb48): /home/joe/repos/rust <14> DW_AT_GNU_dwo_name: (indirect string, offset: 0x5d1b0): foo.foo.fc848df41df7a00d-cgu.0.rcgu.dwo ``` In the rmake.rs version I used a 2-line sliding window to check for `DW_AT_comp_dir` and `DW_AT_GNU_dwo_name`, but to look at `DW_AT_comp_dir` specifically. 4. I included a bunch of FIXMEs and ENHANCEMENTs I noticed regarding the test because I didn't want to fix them in this initial port[^enhancement]. 5. The Makefile version didn't test *anything* on Windows (both windows-msvc and windows-gnu). I added some *very* basic and *very* sparse checks for windows-msvc, but I am not willing to spend the effort to expand test coverage to windows-gnu in this initial port. 6. This run-make test is way too big. But I didn't want to expend the effort of breaking this up in this initial port. [^objdump]: the output format differs between `objdump` and `llvm-objdump`, but the same is true for `llvm-objdump` that this is looking at the wrong line. [^gnu-ext]: AFAICT that is a GNU DWARF attribute extension, since it isn't mentioned in DWARFv5 spec [^enhancement]: For instance, the previous path remapping check could in theory be precisely inspected by inspecting `.debug_info` section to look for attribute value of `DW_AT_comp_dir`. But that involves resolving the value of the indirect string, which means you have to: (1) look for offset into string offset table and (2) use *that* offset to find the string itself in the string table. The split part of "split-debuginfo" makes this murky for me, so I wasn't able to replace `llvm-objdump` textual output substring matches with more precise `object` + `gimli` inspections. ## Review advice - I'm sorry for how long the rmake.rs test ended up, but a lot of it is comments and just vertical space due to formatting. If there's any ways to make this test less long / convoluted, advice would be appreciated. - This PR *intentionally* introduces several intermediate commits for the `Makefile`, mostly to illustrate the problems I discovered when looking at the original `Makefile` version. This is intended to highlight the existing problems in the `Makefile` version for the reviewer[^squash]. - There are several intentional non-functional commits: 1. Reindent the `Makefile` to make the platform conditional gating more obvious. 2. Collapse nested if-else branches into an else if construct, which is not supported by GNU Make 3.80. 3. Remove all redundant `-C debuginfo=2` when `-g` is already specified. - This PR is best reviewed commit-by-commit. [^squash]: I intend to squash these intermediate commits away after the reviewer concludes that the current form of the rmake.rs test is acceptable for merge. Before then, I'll keep them to help with review. --- try-job: x86_64-msvc try-job: i686-msvc try-job: i686-mingw try-job: x86_64-mingw-1 try-job: x86_64-apple-1 try-job: aarch64-apple try-job: test-various
This commit is contained in:
commit
f75146fc16
7 changed files with 1652 additions and 377 deletions
|
@ -338,6 +338,18 @@ impl Rustc {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Specify `-C debuginfo=...`.
|
||||||
|
pub fn debuginfo(&mut self, level: &str) -> &mut Self {
|
||||||
|
self.cmd.arg(format!("-Cdebuginfo={level}"));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specify `-C split-debuginfo={packed,unpacked,off}`.
|
||||||
|
pub fn split_debuginfo(&mut self, split_kind: &str) -> &mut Self {
|
||||||
|
self.cmd.arg(format!("-Csplit-debuginfo={split_kind}"));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Pass the `--verbose` flag.
|
/// Pass the `--verbose` flag.
|
||||||
pub fn verbose(&mut self) -> &mut Self {
|
pub fn verbose(&mut self) -> &mut Self {
|
||||||
self.cmd.arg("--verbose");
|
self.cmd.arg("--verbose");
|
||||||
|
|
|
@ -238,9 +238,7 @@ pub fn set_permissions<P: AsRef<Path>>(path: P, perm: std::fs::Permissions) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A function which prints all file names in the directory `dir` similarly to Unix's `ls`.
|
/// List directory entries immediately under the given `dir`.
|
||||||
/// Useful for debugging.
|
|
||||||
/// Usage: `eprintln!("{:#?}", shallow_find_dir_entries(some_dir));`
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn shallow_find_dir_entries<P: AsRef<Path>>(dir: P) -> Vec<PathBuf> {
|
pub fn shallow_find_dir_entries<P: AsRef<Path>>(dir: P) -> Vec<PathBuf> {
|
||||||
let paths = read_dir(dir);
|
let paths = read_dir(dir);
|
||||||
|
|
|
@ -94,8 +94,8 @@ pub use artifact_names::{
|
||||||
|
|
||||||
/// Path-related helpers.
|
/// Path-related helpers.
|
||||||
pub use path_helpers::{
|
pub use path_helpers::{
|
||||||
cwd, filename_contains, filename_not_in_denylist, has_extension, has_prefix, has_suffix,
|
build_root, cwd, filename_contains, filename_not_in_denylist, has_extension, has_prefix,
|
||||||
not_contains, path, shallow_find_files, build_root, source_root,
|
has_suffix, not_contains, path, shallow_find_directories, shallow_find_files, source_root,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Helpers for scoped test execution where certain properties are attempted to be maintained.
|
/// Helpers for scoped test execution where certain properties are attempted to be maintained.
|
||||||
|
|
|
@ -59,6 +59,25 @@ pub fn shallow_find_files<P: AsRef<Path>, F: Fn(&PathBuf) -> bool>(
|
||||||
matching_files
|
matching_files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Browse the directory `path` non-recursively and return all directories which respect the
|
||||||
|
/// parameters outlined by `closure`.
|
||||||
|
#[track_caller]
|
||||||
|
pub fn shallow_find_directories<P: AsRef<Path>, F: Fn(&PathBuf) -> bool>(
|
||||||
|
path: P,
|
||||||
|
filter: F,
|
||||||
|
) -> Vec<PathBuf> {
|
||||||
|
let mut matching_files = Vec::new();
|
||||||
|
for entry in rfs::read_dir(path) {
|
||||||
|
let entry = entry.expect("failed to read directory entry.");
|
||||||
|
let path = entry.path();
|
||||||
|
|
||||||
|
if path.is_dir() && filter(&path) {
|
||||||
|
matching_files.push(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matching_files
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true if the filename at `path` does not contain `expected`.
|
/// Returns true if the filename at `path` does not contain `expected`.
|
||||||
pub fn not_contains<P: AsRef<Path>>(path: P, expected: &str) -> bool {
|
pub fn not_contains<P: AsRef<Path>>(path: P, expected: &str) -> bool {
|
||||||
!path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().contains(expected))
|
!path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().contains(expected))
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
run-make/split-debuginfo/Makefile
|
|
|
@ -1,371 +0,0 @@
|
||||||
# ignore-cross-compile
|
|
||||||
# ignore-riscv64 On this platform only `-Csplit-debuginfo=off` is supported, see #120518
|
|
||||||
|
|
||||||
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 packed-remapped-scope packed-remapped-wrong-scope
|
|
||||||
|
|
||||||
# - 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)
|
|
||||||
|
|
||||||
# - 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-scope:
|
|
||||||
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
|
|
||||||
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
|
|
||||||
-Z remap-path-scope=debuginfo 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-wrong-scope:
|
|
||||||
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
|
|
||||||
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
|
|
||||||
-Z remap-path-scope=macro 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: unpacked-lto-split unpacked-lto-single
|
|
||||||
|
|
||||||
# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
|
|
||||||
# - `.o` present (bitcode)
|
|
||||||
# - `.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
|
|
||||||
rm $(TMPDIR)/*.o
|
|
||||||
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` present (bitcode)
|
|
||||||
# - `.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
|
|
||||||
rm $(TMPDIR)/*.o
|
|
||||||
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 unpacked-remapped-scope unpacked-remapped-wrong-scope
|
|
||||||
|
|
||||||
# - 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
|
|
||||||
rm $(TMPDIR)/*.o
|
|
||||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
|
||||||
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-scope:
|
|
||||||
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
|
|
||||||
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
|
|
||||||
-Z remap-path-scope=debuginfo foo.rs -g
|
|
||||||
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
|
|
||||||
rm $(TMPDIR)/*.o
|
|
||||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
|
||||||
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-wrong-scope:
|
|
||||||
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
|
|
||||||
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
|
|
||||||
-Z remap-path-scope=macro foo.rs -g
|
|
||||||
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1
|
|
||||||
rm $(TMPDIR)/*.o
|
|
||||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
|
||||||
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
|
|
||||||
rm $(TMPDIR)/$(call BIN,foo)
|
|
||||||
|
|
||||||
unpacked-crosscrate: unpacked-crosscrate-split unpacked-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
|
|
1618
tests/run-make/split-debuginfo/rmake.rs
Normal file
1618
tests/run-make/split-debuginfo/rmake.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue