diff options
author | sliquister <valentin.gatienbaron@gmail.com> | 2018-07-27 03:51:53 -0400 |
---|---|---|
committer | Thomas Refis <refis.thomas@gmail.com> | 2018-07-27 08:51:53 +0100 |
commit | ae1317caae6618b8d36b8282b71613b270635fd3 (patch) | |
tree | b5bf04a61ac02095447397064d78e33a7e1ec615 /driver/main.ml | |
parent | b150df811fd7f9c0255a672f1bf4f683059ec7fc (diff) | |
download | ocaml-ae1317caae6618b8d36b8282b71613b270635fd3.tar.gz |
Add option to dump the output of e.g. -dlambda in a file (#1913)
Diffstat (limited to 'driver/main.ml')
-rw-r--r-- | driver/main.ml | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/driver/main.ml b/driver/main.ml index fd4c3c2b20..b8c11a240d 100644 --- a/driver/main.ml +++ b/driver/main.ml @@ -108,6 +108,7 @@ module Options = Main_args.Make_bytecomp_options (struct let _verbose = set verbose let _nopervasives = set nopervasives let _match_context_rows n = match_context_rows := n + let _dump_into_file = set dump_into_file let _dno_unique_ids = unset unique_ids let _dunique_ids = set unique_ids let _dsource = set dump_source @@ -151,8 +152,9 @@ let main () = end; readenv ppf Before_link; if - List.length (List.filter (fun x -> !x) - [make_archive;make_package;compile_only;output_c_object]) + List.length + (List.filter (fun x -> !x) + [make_archive;make_package;compile_only;output_c_object]) > 1 then if !print_types then @@ -162,16 +164,18 @@ let main () = if !make_archive then begin Compmisc.init_path false; - Bytelibrarian.create_archive (Compenv.get_objfiles ~with_ocamlparam:false) - (extract_output !output_name); + Bytelibrarian.create_archive + (Compenv.get_objfiles ~with_ocamlparam:false) + (extract_output !output_name); Warnings.check_fatal (); end else if !make_package then begin Compmisc.init_path false; let extracted_output = extract_output !output_name in let revd = get_objfiles ~with_ocamlparam:false in - Bytepackager.package_files (Compmisc.initial_env ()) - revd (extracted_output); + Compmisc.with_ppf_dump ~fileprefix:extracted_output (fun ppf_dump -> + Bytepackager.package_files ~ppf_dump (Compmisc.initial_env ()) + revd (extracted_output)); Warnings.check_fatal (); end else if not !compile_only && !objfiles <> [] then begin |