@ -123,7 +123,8 @@ let restore_global_state st =
(* * reference to log errors only at the innermost recursive call *)
(* * reference to log errors only at the innermost recursive call *)
let logged_error = ref false
let logged_error = ref false
let analyze summary callee_pdesc =
let analyze callee_summary =
let callee_pdesc = Summary . get_proc_desc callee_summary in
let exe_env = Option . value_exn ! exe_env_ref in
let exe_env = Option . value_exn ! exe_env_ref in
let proc_name = Procdesc . get_proc_name callee_pdesc in
let proc_name = Procdesc . get_proc_name callee_pdesc in
let source_file = ( Procdesc . get_attributes callee_pdesc ) . ProcAttributes . translation_unit in
let source_file = ( Procdesc . get_attributes callee_pdesc ) . ProcAttributes . translation_unit in
@ -137,7 +138,7 @@ let analyze summary callee_pdesc =
in
in
current_taskbar_status := Some ( t0 , status ) ;
current_taskbar_status := Some ( t0 , status ) ;
! ProcessPoolState . update_status t0 status ;
! ProcessPoolState . update_status t0 status ;
let summary = Callbacks . iterate_procedure_callbacks exe_env summary callee_pdesc in
let summary = Callbacks . iterate_procedure_callbacks exe_env callee_summary in
if Topl . is_active () then Topl . add_errors exe_env summary ;
if Topl . is_active () then Topl . add_errors exe_env summary ;
summary
summary
@ -157,8 +158,8 @@ let run_proc_analysis ~caller_pdesc callee_pdesc =
Typ . Procname . pp callee_pname ;
Typ . Procname . pp callee_pname ;
let preprocess () =
let preprocess () =
incr nesting ;
incr nesting ;
let initial_ summary = Summary . reset callee_pdesc in
let initial_ callee_ summary = Summary . reset callee_pdesc in
add_active callee_pname ; initial_ summary
add_active callee_pname ; initial_ callee_ summary
in
in
let postprocess summary =
let postprocess summary =
decr nesting ;
decr nesting ;
@ -182,18 +183,18 @@ let run_proc_analysis ~caller_pdesc callee_pdesc =
Summary . store new_summary ; remove_active callee_pname ; log_elapsed_time () ; new_summary
Summary . store new_summary ; remove_active callee_pname ; log_elapsed_time () ; new_summary
in
in
let old_state = save_global_state () in
let old_state = save_global_state () in
let initial_ summary = preprocess () in
let initial_ callee_ summary = preprocess () in
let attributes = Procdesc . get_attributes callee_pdesc in
let attributes = Procdesc . get_attributes callee_pdesc in
try
try
let summary =
let callee_ summary =
if attributes . ProcAttributes . is_defined then analyze initial_ summary callee_pdesc
if attributes . ProcAttributes . is_defined then analyze initial_ callee_summary
else initial_ summary
else initial_ callee_ summary
in
in
let final_ summary = postprocess summary in
let final_ callee_ summary = postprocess callee_ summary in
restore_global_state old_state ;
restore_global_state old_state ;
(* don't forget to reset this so we output messages for future errors too *)
(* don't forget to reset this so we output messages for future errors too *)
logged_error := false ;
logged_error := false ;
final_ summary
final_ callee_ summary
with exn -> (
with exn -> (
let backtrace = Printexc . get_backtrace () in
let backtrace = Printexc . get_backtrace () in
IExn . reraise_if exn ~ f : ( fun () ->
IExn . reraise_if exn ~ f : ( fun () ->
@ -211,10 +212,10 @@ let run_proc_analysis ~caller_pdesc callee_pdesc =
| SymOp . Analysis_failure_exe kind ->
| SymOp . Analysis_failure_exe kind ->
(* in production mode, log the timeout/crash and continue with the summary we had before
(* in production mode, log the timeout/crash and continue with the summary we had before
the failure occurred * )
the failure occurred * )
log_error_and_continue exn initial_ summary kind
log_error_and_continue exn initial_ callee_ summary kind
| _ ->
| _ ->
(* this happens with assert false or some other unrecognized exception *)
(* this happens with assert false or some other unrecognized exception *)
log_error_and_continue exn initial_ summary ( FKcrash ( Exn . to_string exn ) ) )
log_error_and_continue exn initial_ callee_ summary ( FKcrash ( Exn . to_string exn ) ) )
(* shadowed for tracing *)
(* shadowed for tracing *)