Skip to content

Commit

Permalink
[pulse] a little more logging
Browse files Browse the repository at this point in the history
Summary:
I've found these useful.

In particular, print "ContinueProgram" in front of ContinueProgram
disjuncts just to be more explicit.

Reviewed By: hajduakos, dulmarod

Differential Revision: D67276992

fbshipit-source-id: f144a0a03200906691cb4198dda982f9770809a1
  • Loading branch information
jvillard authored and facebook-github-bot committed Dec 17, 2024
1 parent d79b340 commit db0064a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion infer/src/pulse/PulseCallOperations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@ let call_aux disjunct_limit ({InterproceduralAnalysis.tenv} as analysis_data) pa
(not path.PathContext.is_non_disj)
&& ( Option.exists disjunct_limit ~f:(fun limit -> List.length posts >= limit)
|| (should_keep_at_most_one_disjunct && not (List.is_empty posts)) )
then (posts, contradiction)
then (
L.d_printfln "disjunct limit reached, stop applying callee pre/posts" ;
(posts, contradiction) )
else (
(* apply one pre/post spec, check for timeouts in-between each pre/post spec from the callee
*)
Expand Down
2 changes: 1 addition & 1 deletion infer/src/pulse/PulseExecutionDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let pp_header kind fmt = function
| AbortProgram _ ->
Pp.with_color kind Red F.pp_print_string fmt "AbortProgram"
| ContinueProgram _ ->
()
F.pp_print_string fmt "ContinueProgram"
| ExceptionRaised _ ->
Pp.with_color kind Orange F.pp_print_string fmt "ExceptionRaised"
| ExitProgram _ ->
Expand Down
10 changes: 10 additions & 0 deletions infer/src/pulse/PulseResult.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@
*)

open! IStd
module F = Format
module L = Logging

type ('ok, 'err) t = Ok of 'ok | Recoverable of 'ok * 'err list | FatalError of 'err * 'err list

let pp pp_ok pp_err fmt = function
| Ok ok ->
F.fprintf fmt "Ok (%a)" pp_ok ok
| Recoverable (ok, errs) ->
F.fprintf fmt "Recoverable (%a, [%a])" pp_ok ok (Pp.comma_seq pp_err) errs
| FatalError (err, errs) ->
F.fprintf fmt "FatalError (%a, [%a])" pp_err err (Pp.comma_seq pp_err) errs


let append_errors errors result =
if List.is_empty errors then result
else
Expand Down
8 changes: 8 additions & 0 deletions infer/src/pulse/PulseResult.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
*)

open! IStd
module F = Format

[@@@warning "-unused-value-declaration"]

(** Pulse's base error monad: some errors can be accumulated along paths, others are fatal and
there's no point continuing the execution. *)
type ('ok, 'err) t = Ok of 'ok | Recoverable of 'ok * 'err list | FatalError of 'err * 'err list

val pp :
(F.formatter -> 'ok -> unit)
-> (F.formatter -> 'err -> unit)
-> F.formatter
-> ('ok, 'err) t
-> unit

val append_errors : 'err list -> ('ok, 'err) t -> ('ok, 'err) t
(** adds the given error list to the result, possibly changing an [Ok] result into a [Recoverable]
one in the process *)
Expand Down

0 comments on commit db0064a

Please sign in to comment.