diff options
| author | Ivan Lozano <ivanlozano@google.com> | 2020-05-26 13:41:40 -0400 |
|---|---|---|
| committer | Ivan Lozano <ivanlozano@google.com> | 2020-05-27 14:10:40 -0400 |
| commit | 0c1ef853bb6ff87c2179b5e41b7e044b6c5b79cb (patch) | |
| tree | 49c8ddc2d0a0988315b2cb38dda4200e3d2cd4fc /src/librustc_codegen_llvm/debuginfo | |
| parent | aeca4d6428c52cbf2c8d1f28657b0bdf92e4ea7c (diff) | |
| download | rust-0c1ef853bb6ff87c2179b5e41b7e044b6c5b79cb.tar.gz rust-0c1ef853bb6ff87c2179b5e41b7e044b6c5b79cb.zip | |
Add -Z profile-emit=<path> for Gcov gcda output.
Adds a -Z flag to control the file path that the Gcov gcda output is written to during runtime. This flag expects a path and filename, e.g. -Z profile-emit=gcov/out/lib.gcda. This works similar to GCC/Clang's -fprofile-dir flag which allows control over the output path for gcda coverage files.
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/metadata.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 0cce0b25e58..333eb805221 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -959,16 +959,16 @@ pub fn compile_unit_metadata( if tcx.sess.opts.debugging_opts.profile { let cu_desc_metadata = llvm::LLVMRustMetadataAsValue(debug_context.llcontext, unit_metadata); + let default_gcda_path = &tcx.output_filenames(LOCAL_CRATE).with_extension("gcda"); + let gcda_path = + tcx.sess.opts.debugging_opts.profile_emit.as_ref().unwrap_or(default_gcda_path); let gcov_cu_info = [ path_to_mdstring( debug_context.llcontext, &tcx.output_filenames(LOCAL_CRATE).with_extension("gcno"), ), - path_to_mdstring( - debug_context.llcontext, - &tcx.output_filenames(LOCAL_CRATE).with_extension("gcda"), - ), + path_to_mdstring(debug_context.llcontext, &gcda_path), cu_desc_metadata, ]; let gcov_metadata = llvm::LLVMMDNodeInContext( |
