[linters] Adapt the debugger and linters-developer-mode to the new logs

Reviewed By: martinoluca, jvillard

Differential Revision: D5264504

fbshipit-source-id: 7109072
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent 0e82560fcc
commit 45a8e48e00

@ -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

@ -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,

@ -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, _, _ ->

Loading…
Cancel
Save