Skip to content

Commit a393267

Browse files
committed
address review comments
1 parent 847dc6e commit a393267

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,22 @@ impl TargetInfo {
463463
should_replace_hyphens: true,
464464
})
465465
} else {
466+
// Because DWARF Package (dwp) files are produced after the
467+
// fact by another tool, there is nothing in the binary that
468+
// provides a means to locate them. By convention, debuggers
469+
// take the binary filename and append ".dwp" (including to
470+
// binaries that already have an extension such as shared libs)
471+
// to find the dwp.
466472
ret.push(FileType {
467-
suffix: format!("{}.dwp", suffix),
473+
// It is important to preserve the existing suffix for
474+
// e.g. shared libraries, where the dwp for libfoo.so is
475+
// expected to be at libfoo.so.dwp.
476+
suffix: format!("{suffix}.dwp"),
468477
prefix: prefix.clone(),
469478
flavor: FileFlavor::DebugInfo,
470479
crate_type: Some(crate_type.clone()),
480+
// Likewise, the dwp needs to match the primary artifact's
481+
// hyphenation exactly.
471482
should_replace_hyphens: crate_type != CrateType::Bin,
472483
})
473484
}

0 commit comments

Comments
 (0)