From 783caf3702fa28aeeaebd413eb9072399506eab1 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Fri, 13 Jan 2023 06:29:46 -0800 Subject: [PATCH] Append .dwp to the binary filename instead of replacing the existing extension. gdb et al. expect to find the dwp file at .dwp, even if already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp). --- compiler/rustc_codegen_ssa/src/back/link.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 8ca7103ed482c..06dbeac2850e7 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -599,7 +599,8 @@ fn link_dwarf_object<'a>( cg_results: &CodegenResults, executable_out_filename: &Path, ) { - let dwp_out_filename = executable_out_filename.with_extension("dwp"); + let mut dwp_out_filename = executable_out_filename.to_path_buf().into_os_string(); + dwp_out_filename.push(".dwp"); debug!(?dwp_out_filename, ?executable_out_filename); #[derive(Default)]