From a393267a286bdb5fa14dc38be9c0254712ea4f74 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Sun, 15 Jan 2023 15:45:16 -0800 Subject: [PATCH] address review comments --- .../core/compiler/build_context/target_info.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index f152a3ba547..2168819a408 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -463,11 +463,22 @@ impl TargetInfo { should_replace_hyphens: true, }) } else { + // Because DWARF Package (dwp) files are produced after the + // fact by another tool, there is nothing in the binary that + // provides a means to locate them. By convention, debuggers + // take the binary filename and append ".dwp" (including to + // binaries that already have an extension such as shared libs) + // to find the dwp. ret.push(FileType { - suffix: format!("{}.dwp", suffix), + // It is important to preserve the existing suffix for + // e.g. shared libraries, where the dwp for libfoo.so is + // expected to be at libfoo.so.dwp. + suffix: format!("{suffix}.dwp"), prefix: prefix.clone(), flavor: FileFlavor::DebugInfo, crate_type: Some(crate_type.clone()), + // Likewise, the dwp needs to match the primary artifact's + // hyphenation exactly. should_replace_hyphens: crate_type != CrateType::Bin, }) }