[topl] Print debugging output on -g.

Summary: Previously, one needed both --topl-trace and -g.

Reviewed By: ngorogiannis

Differential Revision: D19035493

fbshipit-source-id: 1abb49384
master
Radu Grigore 5 years ago committed by Facebook Github Bot
parent 3e9d1bff16
commit 4f362ba977

@ -51,8 +51,7 @@ let evaluate_static_guard label (e_fun, arg_ts) =
let name = Typ.Procname.hashable_name n in
let re = Str.regexp label.ToplAst.procedure_name in
let result = Str.string_match re name 0 in
if Config.trace_topl then
tt "match name='%s' re='%s' result=%b@\n" name label.ToplAst.procedure_name result ;
tt "match name='%s' re='%s' result=%b@\n" name label.ToplAst.procedure_name result ;
result
| _ ->
false

@ -56,7 +56,7 @@ let make properties =
in
Array.of_list (List.dedup_and_sort ~compare:Vname.compare (List.concat_map ~f properties))
in
if Config.trace_topl then Array.iteri ~f:(fun i (p, v) -> tt "state[%d]=(%s,%s)@\n" i p v) states ;
Array.iteri ~f:(fun i (p, v) -> tt "state[%d]=(%s,%s)@\n" i p v) states ;
let vindex = index_in (module Vname.Table) states in
let transitions : transition array =
let f p =
@ -77,9 +77,8 @@ let make properties =
in
Array.of_list (List.concat_map ~f properties)
in
if Config.trace_topl then
Array.iteri transitions ~f:(fun i {source; target; label} ->
tt "transition%d %d -> %d on %s@\n" i source target label.ToplAst.procedure_name ) ;
Array.iteri transitions ~f:(fun i {source; target; label} ->
tt "transition%d %d -> %d on %s@\n" i source target label.ToplAst.procedure_name ) ;
let outgoing : tindex list array =
let vcount = Array.length states in
let a = Array.create ~len:vcount [] in

@ -52,5 +52,6 @@ let is_synthesized = function
let debug fmt =
Logging.debug Analysis Verbose "ToplTrace: " ;
Logging.debug Analysis Verbose fmt
let mode = if Config.trace_topl then Logging.Quiet else Logging.Verbose in
Logging.debug Analysis mode "ToplTrace: " ;
Logging.debug Analysis mode fmt

Loading…
Cancel
Save