Skip to content

Commit

Permalink
[debug html] make html file printing re-entrant
Browse files Browse the repository at this point in the history
Summary:
Right now there should be no way to re-enter the analysis of the same
proc name within the same OCaml process (Property 1) but still a good
property to have.

The real reason is that I want to violate Property 1.

Reviewed By: ngorogiannis

Differential Revision: D62582808

fbshipit-source-id: a0028c29c5911755e6b6b06e292241f0eb92fd64
  • Loading branch information
jvillard authored and facebook-github-bot committed Sep 12, 2024
1 parent 2c77811 commit 3530268
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions infer/src/backend/printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ end = struct
else (true, Io_infer.Html.create source node_path)
in
curr_html_formatter := fmt ;
Hashtbl.replace log_files (node_fname, source) fd ;
Hashtbl.add log_files (node_fname, source) fd ;
if needs_initialization then (
F.fprintf fmt "<center><h1>Cfg Node %a</h1></center>"
(Io_infer.Html.pp_line_link source ~text:(Some (string_of_int nodeid)) [".."])
Expand Down Expand Up @@ -115,16 +115,15 @@ end = struct

let finish_session node =
F.fprintf !curr_html_formatter "</LISTING>@?" ;
let fd =
let source = (Procdesc.Node.get_loc node).file in
let node_fname =
let proc_name = Procdesc.Node.get_proc_name node in
let nodeid = (Procdesc.Node.get_id node :> int) in
Io_infer.Html.node_filename proc_name nodeid
in
Hashtbl.find log_files (node_fname, source)
let source = (Procdesc.Node.get_loc node).file in
let node_fname =
let proc_name = Procdesc.Node.get_proc_name node in
let nodeid = (Procdesc.Node.get_id node :> int) in
Io_infer.Html.node_filename proc_name nodeid
in
let fd = Hashtbl.find log_files (node_fname, source) in
Unix.close fd ;
Hashtbl.remove log_files (node_fname, source) ;
curr_html_formatter := F.std_formatter
end

Expand Down

0 comments on commit 3530268

Please sign in to comment.