[pulse] rename PulseTrace.t -> PulseTrace.breadcrumbs

Summary:
In preparation for the next diff that re-uses `PulseTrace.t` for a type
that combines breadcrumbs + action.

No change intended.

Reviewed By: mbouaziz, jberdine

Differential Revision: D15354437

fbshipit-source-id: cbb8757b4
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent dc89f3b5a4
commit 70d38cea77

@ -75,8 +75,8 @@ module PrePost : sig
-> Location.t -> Location.t
-> t -> t
-> formals:Var.t list -> formals:Var.t list
-> ret:AbstractAddress.t * PulseTrace.t -> ret:AbstractAddress.t * PulseTrace.breadcrumbs
-> actuals:(AbstractAddress.t * HilExp.AccessExpression.t * PulseTrace.t) option list -> actuals:(AbstractAddress.t * HilExp.AccessExpression.t * PulseTrace.breadcrumbs) option list
-> domain_t -> domain_t
-> (domain_t, PulseDiagnostic.t) result -> (domain_t, PulseDiagnostic.t) result
end end

@ -13,8 +13,11 @@ type t =
{ access: HilExp.AccessExpression.t { access: HilExp.AccessExpression.t
; invalidated_by: PulseInvalidation.t PulseTrace.action ; invalidated_by: PulseInvalidation.t PulseTrace.action
; accessed_by: HilExp.AccessExpression.t PulseTrace.action ; accessed_by: HilExp.AccessExpression.t PulseTrace.action
; trace: PulseTrace.t } ; trace: PulseTrace.breadcrumbs }
| StackVariableAddressEscape of {variable: Var.t; trace: PulseTrace.t; location: Location.t} | StackVariableAddressEscape of
{ variable: Var.t
; trace: PulseTrace.breadcrumbs
; location: Location.t }
let describe_access = PulseTrace.pp_action (Pp.in_backticks HilExp.AccessExpression.pp) let describe_access = PulseTrace.pp_action (Pp.in_backticks HilExp.AccessExpression.pp)
@ -78,11 +81,11 @@ let get_trace = function
(PulseTrace.outer_location_of_action accessed_by) (PulseTrace.outer_location_of_action accessed_by)
@@ PulseTrace.add_errlog_of_action ~nesting:1 pp_invalid_access accessed_by @@ PulseTrace.add_errlog_of_action ~nesting:1 pp_invalid_access accessed_by
@@ add_header_if_some ~title:"trace of how the access expression was constructed starts here" @@ add_header_if_some ~title:"trace of how the access expression was constructed starts here"
(PulseTrace.get_start_location trace) (PulseTrace.start_location_of_breadcrumbs trace)
@@ PulseTrace.add_errlog_of_trace ~nesting:1 trace @@ PulseTrace.add_errlog_of_breadcrumbs ~nesting:1 trace
@@ [] @@ []
| StackVariableAddressEscape {trace; location; _} -> | StackVariableAddressEscape {trace; location; _} ->
PulseTrace.add_errlog_of_trace ~nesting:0 trace PulseTrace.add_errlog_of_breadcrumbs ~nesting:0 trace
@@ @@
let nesting = 0 in let nesting = 0 in
[Errlog.make_trace_element nesting location "returned here" []] [Errlog.make_trace_element nesting location "returned here" []]

@ -13,8 +13,11 @@ type t =
{ access: HilExp.AccessExpression.t { access: HilExp.AccessExpression.t
; invalidated_by: PulseInvalidation.t PulseTrace.action ; invalidated_by: PulseInvalidation.t PulseTrace.action
; accessed_by: HilExp.AccessExpression.t PulseTrace.action ; accessed_by: HilExp.AccessExpression.t PulseTrace.action
; trace: PulseTrace.t } ; trace: PulseTrace.breadcrumbs }
| StackVariableAddressEscape of {variable: Var.t; trace: PulseTrace.t; location: Location.t} | StackVariableAddressEscape of
{ variable: Var.t
; trace: PulseTrace.breadcrumbs
; location: Location.t }
val get_message : t -> string val get_message : t -> string

@ -128,11 +128,11 @@ module AbstractAddressMap = PrettyPrintable.MakePPMap (AbstractAddress)
(* {3 Heap domain } *) (* {3 Heap domain } *)
module AddrTracePair = struct module AddrTracePair = struct
type t = AbstractAddress.t * PulseTrace.t [@@deriving compare] type t = AbstractAddress.t * PulseTrace.breadcrumbs [@@deriving compare]
let pp f addr_trace = let pp f addr_trace =
if Config.debug_level_analysis >= 3 then if Config.debug_level_analysis >= 3 then
Pp.pair ~fst:AbstractAddress.pp ~snd:PulseTrace.pp f addr_trace Pp.pair ~fst:AbstractAddress.pp ~snd:PulseTrace.pp_breadcrumbs f addr_trace
else AbstractAddress.pp f (fst addr_trace) else AbstractAddress.pp f (fst addr_trace)
end end

@ -58,7 +58,7 @@ module Stack : sig
end end
module AddrTracePair : sig module AddrTracePair : sig
type t = AbstractAddress.t * PulseTrace.t [@@deriving compare] type t = AbstractAddress.t * PulseTrace.breadcrumbs [@@deriving compare]
end end
module Memory : sig module Memory : sig

@ -41,22 +41,23 @@ val read :
Location.t Location.t
-> HilExp.AccessExpression.t -> HilExp.AccessExpression.t
-> t -> t
-> (t * (AbstractAddress.t * PulseTrace.t)) access_result -> (t * (AbstractAddress.t * PulseTrace.breadcrumbs)) access_result
val read_all : Location.t -> HilExp.AccessExpression.t list -> t -> t access_result val read_all : Location.t -> HilExp.AccessExpression.t list -> t -> t access_result
val havoc_var : PulseTrace.t -> Var.t -> t -> t val havoc_var : PulseTrace.breadcrumbs -> Var.t -> t -> t
val havoc : PulseTrace.t -> Location.t -> HilExp.AccessExpression.t -> t -> t access_result val havoc :
PulseTrace.breadcrumbs -> Location.t -> HilExp.AccessExpression.t -> t -> t access_result
val realloc_var : Var.t -> Location.t -> t -> t val realloc_var : Var.t -> Location.t -> t -> t
val write_var : Var.t -> AbstractAddress.t * PulseTrace.t -> t -> t val write_var : Var.t -> AbstractAddress.t * PulseTrace.breadcrumbs -> t -> t
val write : val write :
Location.t Location.t
-> HilExp.AccessExpression.t -> HilExp.AccessExpression.t
-> AbstractAddress.t * PulseTrace.t -> AbstractAddress.t * PulseTrace.breadcrumbs
-> t -> t
-> t access_result -> t access_result
@ -77,7 +78,7 @@ val invalidate_array_elements :
val remove_vars : Var.t list -> t -> t val remove_vars : Var.t list -> t -> t
val check_address_escape : val check_address_escape :
Location.t -> Procdesc.t -> AbstractAddress.t -> PulseTrace.t -> t -> t access_result Location.t -> Procdesc.t -> AbstractAddress.t -> PulseTrace.breadcrumbs -> t -> t access_result
module Interproc : sig module Interproc : sig
val call : val call :

@ -62,15 +62,20 @@ let errlog_trace_elem_of_breadcrumb ~nesting crumb =
Errlog.make_trace_element nesting location description tags Errlog.make_trace_element nesting location description tags
type t = breadcrumb list [@@deriving compare] type breadcrumbs = breadcrumb list [@@deriving compare]
let pp f trace = Pp.seq ~print_env:Pp.text_break pp_breadcrumb f trace let pp_breadcrumbs f breadcrumbs = Pp.seq ~print_env:Pp.text_break pp_breadcrumb f breadcrumbs
let add_errlog_of_trace ~nesting trace errlog = let add_errlog_of_breadcrumbs ~nesting breadcrumbs errlog =
List.rev_map_append ~f:(errlog_trace_elem_of_breadcrumb ~nesting) trace errlog List.rev_map_append ~f:(errlog_trace_elem_of_breadcrumb ~nesting) breadcrumbs errlog
let get_start_location = function [] -> None | crumb :: _ -> Some (location_of_breadcrumb crumb) let start_location_of_breadcrumbs = function
| [] ->
None
| crumb :: _ ->
Some (location_of_breadcrumb crumb)
type 'a action = type 'a action =
| Immediate of {imm: 'a; location: Location.t} | Immediate of {imm: 'a; location: Location.t}
@ -112,3 +117,4 @@ let add_errlog_of_action ~nesting pp_immediate action errlog =
let outer_location_of_action = function Immediate {location} | ViaCall {location} -> location let outer_location_of_action = function Immediate {location} | ViaCall {location} -> location

@ -21,14 +21,14 @@ type breadcrumb =
; actuals: HilExp.t list ; actuals: HilExp.t list
; location: Location.t } ; location: Location.t }
type t = breadcrumb list [@@deriving compare] type breadcrumbs = breadcrumb list [@@deriving compare]
val pp : F.formatter -> t -> unit val pp_breadcrumbs : F.formatter -> breadcrumbs -> unit
val add_errlog_of_trace : val add_errlog_of_breadcrumbs :
nesting:int -> t -> Errlog.loc_trace_elem list -> Errlog.loc_trace_elem list nesting:int -> breadcrumbs -> Errlog.loc_trace_elem list -> Errlog.loc_trace_elem list
val get_start_location : t -> Location.t option val start_location_of_breadcrumbs : breadcrumbs -> Location.t option
type 'a action = type 'a action =
| Immediate of {imm: 'a; location: Location.t} | Immediate of {imm: 'a; location: Location.t}

Loading…
Cancel
Save