Skip to content

tests: Port split-debuginfo to rmake.rs #135572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 6, 2025
Prev Previous commit
Next Next commit
tests: remove redundant -C debuginfo=2 when -g is already specified
`-g` is an alias for `-C debuginfo=2`.
  • Loading branch information
jieyouxu committed Feb 1, 2025
commit 95ba76b3c5d78622a6fa5b9d654e5624c4cfb463
48 changes: 24 additions & 24 deletions tests/run-make/split-debuginfo/Makefile
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not follow the unindented version. This is actually needed (as in no indents for the rules) because Makefiles are indent sensitive.

Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.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
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -g \
-Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-g is alias for -C debuginfo=2, specifying twice had me doing a double take

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
Expand All @@ -126,8 +126,8 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.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
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -g \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs
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
Expand All @@ -140,9 +140,9 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.dwo` never created
# - `.dwp` present
packed-remapped-scope:
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -g \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
-Z remap-path-scope=debuginfo foo.rs -g
-Z remap-path-scope=debuginfo foo.rs
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
Expand All @@ -155,9 +155,9 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.dwo` never created
# - `.dwp` present
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check below for the path is also wrong

objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1

because

[03:00] Joe:rust (migrate-split-debuginfo *%) | objdump -Wi foo | grep DW_AT_GNU_dwo_name -B 5 -A 5
objdump: Warning: Unable to load dwo file: /home/joe/repos/rust/foo.foo.fc848df41df7a00d-cgu.0.rcgu.dwo
   Abbrev Offset: 0x0
   Pointer Size:  8
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_stmt_list   : 0x0
    <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
    <18>   DW_AT_GNU_dwo_id  : 0x17249573aa475dc7
    <20>   DW_AT_low_pc      : 0x0
    <28>   DW_AT_ranges      : 0x0
    <2c>   DW_AT_GNU_addr_base: 0x0
  Compilation Unit @ offset 0x30:

DW_AT_GNU_dwo_name's attribute value is the .dwo (or object) file name foo.foo.fc848df41df7a00d-cgu.0.rcgu.dwo, not the containing path /home/joe/repos/rust which is the attr value of DW_AT_comp_dir. So this check is not checking what it thinks it's checking.

packed-remapped-wrong-scope:
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -g \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
-Z remap-path-scope=macro foo.rs -g
-Z remap-path-scope=macro foo.rs
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
Expand All @@ -176,13 +176,13 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - (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
-Zsplit-dwarf-kind=split -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
-C split-debuginfo=packed -Zsplit-dwarf-kind=split -g main.rs
ls $(TMPDIR)/*.o && exit 1 || exit 0
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
rm $(TMPDIR)/main.dwp
Expand All @@ -198,13 +198,13 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - (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
-Zsplit-dwarf-kind=single -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
-C split-debuginfo=packed -Zsplit-dwarf-kind=single -g main.rs
ls $(TMPDIR)/*.o && exit 1 || exit 0
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
rm $(TMPDIR)/main.dwp
Expand Down Expand Up @@ -268,8 +268,8 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.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
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -g \
-Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
ls $(TMPDIR)/*.o && exit 1 || exit 0
rm $(TMPDIR)/*.dwo
Expand All @@ -282,8 +282,8 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.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
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -g \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
rm $(TMPDIR)/*.o
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
Expand All @@ -296,9 +296,9 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.dwo` never created
# - `.dwp` never created
unpacked-remapped-scope:
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -g \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
-Z remap-path-scope=debuginfo foo.rs -g
-Z remap-path-scope=debuginfo foo.rs
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
rm $(TMPDIR)/*.o
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
Expand All @@ -311,9 +311,9 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - `.dwo` never created
# - `.dwp` never created
unpacked-remapped-wrong-scope:
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -g \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
-Z remap-path-scope=macro foo.rs -g
-Z remap-path-scope=macro foo.rs
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1
rm $(TMPDIR)/*.o
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
Expand All @@ -332,13 +332,13 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - (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
-Zsplit-dwarf-kind=split -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
-C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -g main.rs
ls $(TMPDIR)/*.o && exit 1 || exit 0
rm $(TMPDIR)/*.dwo
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
Expand All @@ -354,13 +354,13 @@ else # Some non-Windows, non-Darwin platforms are not stable, and some are.
# - (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
-Zsplit-dwarf-kind=single -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
-C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -g main.rs
ls $(TMPDIR)/*.o
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
Expand Down