Skip to content

Commit

Permalink
GPR#157: store the path of cmos inside debug section at link time
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@16119 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
Damien Doligez committed May 15, 2015
1 parent 9399325 commit 52a39cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ Feature wishes:
(Jacques Garrigue, request by Jun Furuse)
- GPR#139: more versatile specification of locations of .annot
(Christophe Troestler, review by Damien Doligez)
- GPR#157: store the path of cmos inside debug section at link time
(Hugo Heuzard, review by Damien Doligez)

OCaml 4.02.1:
-------------
Expand Down
17 changes: 12 additions & 5 deletions bytecomp/bytelink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ let clear_crc_interfaces () =

(* Record compilation events *)

let debug_info = ref ([] : (int * LongString.t) list)
let debug_info = ref ([] : (int * Instruct.debug_event list * string list) list)

(* Link in a compilation unit *)

Expand All @@ -208,8 +208,14 @@ let link_compunit ppf output_fun currpos_fun inchan file_name compunit =
Symtable.ls_patch_object code_block compunit.cu_reloc;
if !Clflags.debug && compunit.cu_debug > 0 then begin
seek_in inchan compunit.cu_debug;
let buffer = LongString.input_bytes inchan compunit.cu_debugsize in
debug_info := (currpos_fun(), buffer) :: !debug_info
let debug_event_list : Instruct.debug_event list = input_value inchan in
let debug_dirs : string list = input_value inchan in
let file_path = Filename.dirname (Location.absolute_path file_name) in
let debug_dirs =
if List.mem file_path debug_dirs
then debug_dirs
else file_path :: debug_dirs in
debug_info := (currpos_fun(), debug_event_list, debug_dirs) :: !debug_info
end;
Array.iter output_fun code_block;
if !Clflags.link_everything then
Expand Down Expand Up @@ -264,9 +270,10 @@ let link_file ppf output_fun currpos_fun = function
let output_debug_info oc =
output_binary_int oc (List.length !debug_info);
List.iter
(fun (ofs, evl) ->
(fun (ofs, evl, debug_dirs) ->
output_binary_int oc ofs;
Array.iter (output_bytes oc) evl)
output_value oc evl;
output_value oc debug_dirs)
!debug_info;
debug_info := []

Expand Down

0 comments on commit 52a39cc

Please sign in to comment.