From 7721280fa76cad3a0bdd38cc2c629a76893ec31f Mon Sep 17 00:00:00 2001 From: Varun Arora Date: Mon, 26 Feb 2018 05:15:17 -0800 Subject: [PATCH] [reporting] log reason for skipping call in EventLogger.CallTrace Summary: - When a CallTrace result is CR_skip, then a reason for skipping the call will be included in the record Reviewed By: dulmarod Differential Revision: D7082572 fbshipit-source-id: 20ed191 --- infer/src/backend/symExec.ml | 2 +- infer/src/backend/tabulation.ml | 5 +++-- infer/src/backend/tabulation.mli | 3 ++- infer/src/base/EventLogger.ml | 5 +++-- infer/src/base/EventLogger.mli | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/infer/src/backend/symExec.ml b/infer/src/backend/symExec.ml index 8997cf337..d0e28e45a 100644 --- a/infer/src/backend/symExec.ml +++ b/infer/src/backend/symExec.ml @@ -1081,7 +1081,7 @@ let rec sym_exec tenv current_pdesc instr_ (prop_: Prop.normal Prop.t) path () | Some summary -> let proc_name = Specs.get_proc_name summary in - Tabulation.log_call_trace proc_name callee_pname loc Tabulation.CR_skip ) ; + Tabulation.log_call_trace proc_name callee_pname ~reason loc Tabulation.CR_skip ) ; unknown_or_scan_call ~is_scan:false ~reason ret_typ_opt ret_annots Builtin. { pdesc= current_pdesc diff --git a/infer/src/backend/tabulation.ml b/infer/src/backend/tabulation.ml index a81b30f04..b8953bb2c 100644 --- a/infer/src/backend/tabulation.ml +++ b/infer/src/backend/tabulation.ml @@ -83,14 +83,15 @@ let print_results tenv actual_pre results = L.d_strln "***** END RESULTS FUNCTION CALL *******" -let log_call_trace caller_name callee_name loc res = +let log_call_trace caller_name callee_name ?reason loc res = let call_trace = EventLogger.CallTrace { call_location= loc ; call_result= string_of_call_result res ; callee_name= Typ.Procname.to_string callee_name ; caller_name= Typ.Procname.to_string caller_name - ; lang= Typ.Procname.get_language caller_name |> Language.to_explicit_string } + ; lang= Typ.Procname.get_language caller_name |> Language.to_explicit_string + ; reason } in if !Config.footprint then EventLogger.log call_trace diff --git a/infer/src/backend/tabulation.mli b/infer/src/backend/tabulation.mli index 0ab8b9b11..f43636bf1 100644 --- a/infer/src/backend/tabulation.mli +++ b/infer/src/backend/tabulation.mli @@ -17,7 +17,8 @@ type call_result = | CR_not_found (** the callee has no specs *) | CR_skip (** the callee was skipped *) -val log_call_trace : Typ.Procname.t -> Typ.Procname.t -> Location.t -> call_result -> unit +val log_call_trace : + Typ.Procname.t -> Typ.Procname.t -> ?reason:string -> Location.t -> call_result -> unit (** Interprocedural footprint analysis *) diff --git a/infer/src/base/EventLogger.ml b/infer/src/base/EventLogger.ml index ca763c6b5..68892dec5 100644 --- a/infer/src/base/EventLogger.ml +++ b/infer/src/base/EventLogger.ml @@ -110,7 +110,8 @@ type call_trace = ; call_result: string ; callee_name: string ; caller_name: string - ; lang: string } + ; lang: string + ; reason: string option } let create_call_trace_row base record = let open JsonBuilder in @@ -123,7 +124,7 @@ let create_call_trace_row base record = |> add_string ~key:"call_result" ~data:record.call_result |> add_string ~key:"callee_name" ~data:record.callee_name |> add_string ~key:"caller_name" ~data:record.caller_name - |> add_string ~key:"lang" ~data:record.lang + |> add_string ~key:"lang" ~data:record.lang |> add_string_opt ~key:"reason" ~data:record.reason type frontend_exception = diff --git a/infer/src/base/EventLogger.mli b/infer/src/base/EventLogger.mli index 046705d0c..7d2f507b1 100644 --- a/infer/src/base/EventLogger.mli +++ b/infer/src/base/EventLogger.mli @@ -23,7 +23,8 @@ type call_trace = ; call_result: string ; callee_name: string ; caller_name: string - ; lang: string } + ; lang: string + ; reason: string option } type frontend_exception = { ast_node: string option