about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/back/write.rs
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2022-03-26 18:29:37 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2022-03-26 18:29:37 +0100
commitbbff48e09463618dde1627883a350b7427ae6d44 (patch)
tree84d7f352faf7b9dc8f37d379b9f79311160bf7fe /compiler/rustc_codegen_gcc/src/back/write.rs
parent1fca19c8ca4ae5e71e8b17a82c3acfeb78c48891 (diff)
parent39683d8eb7a32a74bea96ecbf1e87675d3338506 (diff)
downloadrust-bbff48e09463618dde1627883a350b7427ae6d44.tar.gz
rust-bbff48e09463618dde1627883a350b7427ae6d44.zip
Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_gcc-2022-03-26
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/back/write.rs')
-rw-r--r--compiler/rustc_codegen_gcc/src/back/write.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_gcc/src/back/write.rs b/compiler/rustc_codegen_gcc/src/back/write.rs
index 334ef32f1d1..b503bd020f6 100644
--- a/compiler/rustc_codegen_gcc/src/back/write.rs
+++ b/compiler/rustc_codegen_gcc/src/back/write.rs
@@ -45,7 +45,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
                 if env::var("CG_GCCJIT_DUMP_MODULE_NAMES").as_deref() == Ok("1") {
                     println!("Module {}", module.name);
                 }
-                if env::var("CG_GCCJIT_DUMP_MODULE").as_deref() == Ok(&module.name) {
+                if env::var("CG_GCCJIT_DUMP_ALL_MODULES").as_deref() == Ok("1") || env::var("CG_GCCJIT_DUMP_MODULE").as_deref() == Ok(&module.name) {
                     println!("Dumping reproducer {}", module.name);
                     let _ = fs::create_dir("/tmp/reproducers");
                     // FIXME(antoyo): segfault in dump_reproducer_to_file() might be caused by
@@ -54,6 +54,11 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
                     context.dump_reproducer_to_file(&format!("/tmp/reproducers/{}.c", module.name));
                     println!("Dumped reproducer {}", module.name);
                 }
+                if env::var("CG_GCCJIT_DUMP_TO_FILE").as_deref() == Ok("1") {
+                    let _ = fs::create_dir("/tmp/gccjit_dumps");
+                    let path = &format!("/tmp/gccjit_dumps/{}.c", module.name);
+                    context.dump_to_file(path, true);
+                }
                 context.compile_to_file(OutputKind::ObjectFile, obj_out.to_str().expect("path to str"));
             }