From c4701f8a04504f99b04bd93726a5696d74a3ce13 Mon Sep 17 00:00:00 2001 From: Dino Distefano Date: Thu, 15 Nov 2018 08:03:55 -0800 Subject: [PATCH] Fix ERROR RUNNING BACKEND Reviewed By: mbouaziz Differential Revision: D13082108 fbshipit-source-id: 1c21b9e9f --- infer/src/backend/reporting.ml | 11 +++++++++-- infer/src/biabduction/State.ml | 6 ++++++ infer/src/biabduction/State.mli | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/infer/src/backend/reporting.ml b/infer/src/backend/reporting.ml index 58b7cd2e7..b9e7553d0 100644 --- a/infer/src/backend/reporting.ml +++ b/infer/src/backend/reporting.ml @@ -92,9 +92,16 @@ let log_issue_external procname severity ~loc ~ltr ?access issue_type error_mess let log_error_using_state summary exn = if !BiabductionConfig.footprint then - let node = Errlog.BackendNode {node= State.get_node_exn ()} in + let node' = + match State.get_node () with + | Some n -> + n + | None -> + Procdesc.get_start_node (Summary.get_proc_desc summary) + in + let node = Errlog.BackendNode {node= node'} in let session = State.get_session () in - let loc = State.get_loc_exn () in + let loc = match State.get_loc () with Some l -> l | None -> Procdesc.Node.get_loc node' in let ltr = State.get_loc_trace () in log_issue_from_summary Exceptions.Error summary ~node ~session ~loc ~ltr exn diff --git a/infer/src/biabduction/State.ml b/infer/src/biabduction/State.ml index a33d8aee7..d15ae786e 100644 --- a/infer/src/biabduction/State.ml +++ b/infer/src/biabduction/State.ml @@ -86,6 +86,8 @@ let get_instr () = !gs.last_instr let get_node_exn () = Option.value_exn !gs.last_node +let get_node () = !gs.last_node + let get_loc_exn () = match !gs.last_instr with | Some instr -> @@ -94,6 +96,10 @@ let get_loc_exn () = get_node_exn () |> Procdesc.Node.get_loc +let get_loc () = + match !gs.last_instr with Some instr -> Some (Sil.instr_get_loc instr) | None -> None + + (** normalize the list of instructions by renaming let-bound ids *) let instrs_normalize instrs = let bound_ids = diff --git a/infer/src/biabduction/State.mli b/infer/src/biabduction/State.mli index c61f11d65..6f306aa98 100644 --- a/infer/src/biabduction/State.mli +++ b/infer/src/biabduction/State.mli @@ -31,12 +31,18 @@ val get_instr : unit -> Sil.instr option val get_loc_exn : unit -> Location.t (** Get last location seen in symbolic execution *) +val get_loc : unit -> Location.t option +(** Get last location seen in symbolic execution *) + val get_loc_trace : unit -> Errlog.loc_trace (** Get the location trace of the last path seen in symbolic execution *) val get_node_exn : unit -> Procdesc.Node.t (** Get last node seen in symbolic execution *) +val get_node : unit -> Procdesc.Node.t option +(** Get last node seen in symbolic execution *) + val get_normalized_pre : (Tenv.t -> Prop.normal Prop.t -> Prop.normal Prop.t) -> Prop.normal Prop.t option (** return the normalized precondition extracted form the last prop seen, if any