[debug] Links to non-visited nodes

Reviewed By: jvillard

Differential Revision: D5137727

fbshipit-source-id: 471f9e7
master
Mehdi Bouaziz 8 years ago committed by Facebook Github Bot
parent 46a539df82
commit 2d73c71845

@ -214,9 +214,7 @@ struct
description description
(if not isvisited then "\nNOT VISITED" else "") in (if not isvisited then "\nNOT VISITED" else "") in
F.asprintf "%t" pp in F.asprintf "%t" pp in
if not isvisited pp_link ~path: (path_to_root @ ["nodes"; node_fname]) fmt node_text
then F.fprintf fmt " %s" node_text
else pp_link ~path: (path_to_root @ ["nodes"; node_fname]) fmt node_text
(** Print an html link to the given proc *) (** Print an html link to the given proc *)
let pp_proc_link path_to_root proc_name fmt text = let pp_proc_link path_to_root proc_name fmt text =
@ -235,9 +233,13 @@ struct
(match text with Some s -> s | None -> linenum_str) (match text with Some s -> s | None -> linenum_str)
(** Print an html link given node id and session *) (** Print an html link given node id and session *)
let pp_session_link ?(with_name = false) source path_to_root fmt (node_id, session, linenum) = let pp_session_link ?(with_name = false) ?proc_name source path_to_root fmt
let node_name = "node" ^ (string_of_int node_id) in (node_id, session, linenum) =
let path_to_node = path_to_root @ ["nodes"; node_name] in let node_name = "node" ^ string_of_int node_id in
let node_fname = match proc_name with
| Some pname -> node_filename pname node_id
| None -> node_name in
let path_to_node = path_to_root @ ["nodes"; node_fname] in
let pos = "session" ^ (string_of_int session) in let pos = "session" ^ (string_of_int session) in
pp_link pp_link
~name: (if with_name then Some pos else None) ~name: (if with_name then Some pos else None)

@ -55,7 +55,8 @@ module Html : sig
(** Print an html link given node id and session *) (** Print an html link given node id and session *)
val pp_session_link : val pp_session_link :
?with_name: bool -> SourceFile.t -> string list -> Format.formatter -> int * int * int -> unit ?with_name: bool -> ?proc_name: Typ.Procname.t -> SourceFile.t ->
string list -> Format.formatter -> int * int * int -> unit
(** Print start color *) (** Print start color *)
val pp_start_color : Format.formatter -> Pp.color -> unit val pp_start_color : Format.formatter -> Pp.color -> unit

@ -104,6 +104,18 @@ module NodesHtml : sig
end = struct end = struct
let log_files = Hashtbl.create 11 let log_files = Hashtbl.create 11
let pp_node_link fmt node =
Io_infer.Html.pp_node_link
[".."]
(Procdesc.Node.get_proc_name node)
~description:""
~preds:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_preds node) :> int list)
~succs:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_succs node) :> int list)
~exn:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_exn node) :> int list)
~isvisited:(is_visited node)
~isproof:false
fmt (Procdesc.Node.get_id node :> int)
let start_node nodeid loc proc_name preds succs exns source = let start_node nodeid loc proc_name preds succs exns source =
let node_fname = Io_infer.Html.node_filename proc_name nodeid in let node_fname = Io_infer.Html.node_filename proc_name nodeid in
let modified = Io_infer.Html.modified_during_analysis source ["nodes"; node_fname] in let modified = Io_infer.Html.modified_during_analysis source ["nodes"; node_fname] in
@ -126,41 +138,11 @@ end = struct
(Escape.escape_xml (Typ.Procname.to_string proc_name)) (Escape.escape_xml (Typ.Procname.to_string proc_name))
(Io_infer.Html.pp_line_link source [".."]) loc.Location.line; (Io_infer.Html.pp_line_link source [".."]) loc.Location.line;
F.fprintf fmt "<br>PREDS:@\n"; F.fprintf fmt "<br>PREDS:@\n";
List.iter ~f:(fun node -> List.iter ~f:(pp_node_link fmt) preds;
Io_infer.Html.pp_node_link
[".."]
(Procdesc.Node.get_proc_name node)
~description:""
~preds:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_preds node) :> int list)
~succs:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_succs node) :> int list)
~exn:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_exn node) :> int list)
~isvisited:(is_visited node)
~isproof:false
fmt (Procdesc.Node.get_id node :> int)) preds;
F.fprintf fmt "<br>SUCCS: @\n"; F.fprintf fmt "<br>SUCCS: @\n";
List.iter ~f:(fun node -> List.iter ~f:(pp_node_link fmt) succs;
Io_infer.Html.pp_node_link
[".."]
(Procdesc.Node.get_proc_name node)
~description:""
~preds:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_preds node) :> int list)
~succs:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_succs node) :> int list)
~exn:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_exn node) :> int list)
~isvisited:(is_visited node)
~isproof:false
fmt (Procdesc.Node.get_id node :> int)) succs;
F.fprintf fmt "<br>EXN: @\n"; F.fprintf fmt "<br>EXN: @\n";
List.iter ~f:(fun node -> List.iter ~f:(pp_node_link fmt) exns;
Io_infer.Html.pp_node_link
[".."]
(Procdesc.Node.get_proc_name node)
~description:""
~preds:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_preds node) :> int list)
~succs:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_succs node) :> int list)
~exn:(List.map ~f:Procdesc.Node.get_id (Procdesc.Node.get_exn node) :> int list)
~isvisited:(is_visited node)
~isproof:false
fmt (Procdesc.Node.get_id node :> int)) exns;
F.fprintf fmt "<br>@\n"; F.fprintf fmt "<br>@\n";
F.pp_print_flush fmt (); F.pp_print_flush fmt ();
true true
@ -388,7 +370,7 @@ let start_session node (loc: Location.t) proc_name session source =
Io_infer.Html.pp_end_color ()); Io_infer.Html.pp_end_color ());
F.fprintf !curr_html_formatter "%a%a" F.fprintf !curr_html_formatter "%a%a"
Io_infer.Html.pp_hline () Io_infer.Html.pp_hline ()
(Io_infer.Html.pp_session_link source ~with_name: true [".."]) (Io_infer.Html.pp_session_link source ~with_name: true [".."] ~proc_name)
((node_id :> int), session, loc.Location.line); ((node_id :> int), session, loc.Location.line);
F.fprintf !curr_html_formatter "<LISTING>%a" F.fprintf !curr_html_formatter "<LISTING>%a"
Io_infer.Html.pp_start_color Pp.Black Io_infer.Html.pp_start_color Pp.Black

Loading…
Cancel
Save