From 34cc6a603f34a430fc3b9a7071dcc1e19b2b7250 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sun, 4 Oct 2015 22:15:20 +0200 Subject: Ensure that there are file directives for all files used in the debug information. --- backend/Fileinfo.ml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'backend/Fileinfo.ml') diff --git a/backend/Fileinfo.ml b/backend/Fileinfo.ml index afdea382..0490def0 100644 --- a/backend/Fileinfo.ml +++ b/backend/Fileinfo.ml @@ -42,16 +42,17 @@ let enter_filename f = (* Add file and line debug location, using GNU assembler-style DWARF2 directives *) +let print_file oc file = + try + Hashtbl.find filename_info file + with Not_found -> + let (filenum, filebuf as res) = enter_filename file in + fprintf oc " .file %d %S\n" filenum file; + res let print_file_line oc pref file line = if !Clflags.option_g && file <> "" then begin - let (filenum, filebuf) = - try - Hashtbl.find filename_info file - with Not_found -> - let (filenum, filebuf as res) = enter_filename file in - fprintf oc " .file %d %S\n" filenum file; - res in + let (filenum, filebuf) = print_file oc file in fprintf oc " .loc %d %d\n" filenum line; match filebuf with | None -> () -- cgit