From 45a8e48e00c4d90864c1dc6f466d9779ce063084 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Fri, 16 Jun 2017 07:16:37 -0700 Subject: [PATCH] [linters] Adapt the debugger and linters-developer-mode to the new logs Reviewed By: martinoluca, jvillard Differential Revision: D5264504 fbshipit-source-id: 7109072 --- infer/src/backend/infer.ml | 2 ++ infer/src/base/Config.ml | 4 ++-- infer/src/clang/cTL.ml | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index 58b11e376..d2f7c44de 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -590,6 +590,8 @@ let setup_results_dir () = let () = if Config.print_builtins then Builtin.print_and_exit (); setup_results_dir (); + if Config.debug_mode then + L.progress "Logs in %s@." (Config.results_dir ^/ Config.log_file); match Config.command with | Analyze -> let pp_cluster_opt fmt = function diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 830758bec..92197e594 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -938,10 +938,10 @@ and ( CLOpt.mk_bool_group ~long:"linters-developer-mode" ~in_help:CLOpt.[Capture, manual_clang_linters] "Debug mode for developing new linters. (Sets the analyzer to $(b,linters); also sets \ - $(b,--debug), $(b,--debug-level-linters 2), $(b,--developer-mode), $(b,--print-logs), and \ + $(b,--debug), $(b,--debug-level-linters 2), $(b,--developer-mode), and \ unsets $(b,--allowed-failures) and $(b,--default-linters)." ~f:(fun debug -> debug_level_linters := if debug then 2 else 0; debug) - [debug; developer_mode; print_logs] [failures_allowed; default_linters] + [debug; developer_mode] [failures_allowed; default_linters] in ( bo_debug, diff --git a/infer/src/clang/cTL.ml b/infer/src/clang/cTL.ml index 791d9a391..621faf55a 100644 --- a/infer/src/clang/cTL.ml +++ b/infer/src/clang/cTL.ml @@ -286,7 +286,7 @@ module Debug = struct (pp_ast ~ast_node_to_highlight ~prettifier:(ANSITerminal.sprintf highlight_style "%s")) ast_root in - L.(debug Linters Medium) + L.progress "@\nNode ID: %d\tEvaluation stack level: %d\tSource line-number: %s@\n" eval_node.id (Stack.length t.eval_stack) @@ -296,13 +296,13 @@ module Debug = struct | Eval_undefined -> true | _ -> false in if is_last_occurrence && is_eval_result_undefined then - L.(debug Linters Medium) + L.progress "From this step, a transition to a different part of the AST may follow.@\n"; let phi_str = Format.asprintf "%a" pp_formula eval_node.content.phi in - L.(debug Linters Medium) "CTL Formula: %s@\n@\n" phi_str; - L.(debug Linters Medium) "%s@\n" ast_str; + L.progress "CTL Formula: %s@\n@\n" phi_str; + L.progress "%s@\n" ast_str; let quit_token = "q" in - L.(debug Linters Medium) "Press Enter to continue or type %s to quit... @?" quit_token; + L.progress "Press Enter to continue or type %s to quit... @?" quit_token; match read_line () |> String.lowercase with | s when String.equal s quit_token -> exit 0 | _ -> @@ -315,7 +315,7 @@ module Debug = struct ) in match t.debugger_active, t.breakpoint_line, line_number eval_node.content.ast_node with | false, Some break_point_ln, Some ln when ln >= break_point_ln -> - L.(debug Linters Medium) "Attaching debugger at line %d" ln; + L.progress "Attaching debugger at line %d" ln; stop_and_explain_step (); {t with debugger_active = true} | true, _, _ ->