diff --git a/CHANGELOG.md b/CHANGELOG.md index 2baa47b..e9be533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ ## [2.0.0] -- current +Great simplification: release 2.0 has in some regards less flexibility than earlier releases, but it's easier to use. + ### Changed -- +- Move `no_debug_if` to the generic interface (the last remaining non-config functionality missing from it). It's ignored (no-op) for the flushing backend. +- Move to linear log levels per-entry and per-log, where an unspecified log level inherits from the entry it's in, determined statically. ## [1.6.1] -- 2024-08-21 diff --git a/README.md b/README.md index 379b3fd..aa091b2 100644 --- a/README.md +++ b/README.md @@ -448,18 +448,9 @@ The `%diagn_` extension points (short for "diagnostic") are tailored for the "lo In the `PrintBox` backend, logs accumulate until the current toplevel log scope is closed. This is unfortunate in the logging framework context, where promptly informing the user using the logs might be important. To remedy this, `PrintBox_runtime` offers the setting `snapshot_every_sec`. When set, if sufficient time has passed since the last output, the backend will output the whole current toplevel log scope. If possible, the previous snapshot of the same log scope is erased, to not duplicate information. The underlying mechanism is available as [snapshot] in the generic interface; it does nothing in the flushing backend. [snapshot] is useful when there's a risk of a "premature" exit of the debugged program or thread. -The log levels are: +The log levels are integers intended to be within the range 0-9, where 0 means no logging at all. They can be provided explicitly by all extension entry points and all explicit logging extensions. When omitted, the log level of the enclosing log entry is used; the default for a top-level log entry is log level 1. -- `Nothing` -- the runtime should not generate anything, and when used at compile time, the extension should not generate any `ppx_minidebug`-related code. However, just changing the log level should not break the code, therefore the runtime-passing transformation (i.e. the first-class-module argument added by the `_rt_` and `_rtb_` infixes) happens even for the `Nothing` log level. -- `Prefixed [| prefix1; ... |]` -- only values starting with one of: prefix1, ... should be logged; at compile time, only logs with literals having one of prefix1, ... as a prefix, should be generated. Moreover, also don't log "empty entries" (see below). To preserve the hierarchical context, also log headers of logging scopes. -- `Prefixed_or_result [| prefix1; ... |]` as above, but also log results of computations. At runtime doesn't output results of an entry if there are no non-result logs. -- `Prefixed [||]` is compile-time only -- outputs all and only explicit logs (i.e. `%log`, `%log_result`, `%log_printbox`, `%log_entry` statements). -- `Prefixed_or_result [||]` at compile-time -- as above, but also log results of computations. -- `Prefixed_or_result [||]` at runtime -- only log results of computations if an entry has non-result logs. -- `Nonempty_entries` -- do not log subtrees, such as functions or control flow blocks, that do not have sub-logs. Exception: explicit `%log_entry` subtrees. -- `Everything` -- no restrictions. - -The `%diagn_` extension points are a shorthand for setting the compile-time log level to `Prefixed [||]`, or `Prefixed prefixes` when the log level has already been either `Prefixed prefixes` or `Prefixed_or_result prefixes`. Example from the test suite: +The `%diagn_` extension points further restrict logging to explicit logs only. Example from the test suite: ```ocaml let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -1245,7 +1236,7 @@ Here is a probably incomplete list of the restrictions: - Hard-coded special cases: we do decompose the option type and the list type. For example: `let%track_show f : int option -> unit = function None -> () | Some _x -> () in f (Some 3)` will log the value of `_x`. - Another example of only propagating types top-down: - `let%track_show f (l : int option) : int = match l with Some y -> ...` will not log `y` when `f` is applied (but it will log `l`). - - Both `let%track_show f : int option -> int = function Some y -> ...` and `let%track_show f l : int = match (l : int option) with Some y -> ...` *will* log `y`. + - Both `let%track_show f : int option -> int = function Some y -> ...` and `let%track_show f l : int = match (l : int option) with Some y -> ...` _will_ log `y`. - We try reconstructing or guessing the types of expressions logged with `%log` and `%log_result`, see details below. As a help in debugging whether the right type information got propagated, we offer the extension `%debug_type_info` (and `%global_debug_type_info`). (The display strips module qualifiers from types.) `%debug_type_info` is not an entry extension point (`%global_debug_type_info` is). Example [from the test suite](test/test_expect_test.ml): diff --git a/index.mld b/index.mld index 97dc12b..f23027e 100644 --- a/index.mld +++ b/index.mld @@ -454,18 +454,9 @@ The [%diagn_] extension points (short for "diagnostic") are tailored for the "lo In the [PrintBox] backend, logs accumulate until the current toplevel log scope is closed. This is unfortunate in the logging framework context, where promptly informing the user using the logs might be important. To remedy this, [PrintBox_runtime] offers the setting [snapshot_every_sec]. When set, if sufficient time has passed since the last output, the backend will output the whole current toplevel log scope. If possible, the previous snapshot of the same log scope is erased, to not duplicate information. The underlying mechanism is available as \[snapshot\] in the generic interface; it does nothing in the flushing backend. \[snapshot\] is useful when there's a risk of a "premature" exit of the debugged program or thread. -The log levels are: -{ul {- [Nothing] -- the runtime should not generate anything, and when used at compile time, the extension should not generate any [ppx_minidebug]-related code. However, just changing the log level should not break the code, therefore the runtime-passing transformation (i.e. the first-class-module argument added by the [_rt_] and [_rtb_] infixes) happens even for the [Nothing] log level. -}{- [Prefixed [| prefix1; ... |]] -- only values starting with one of: prefix1, ... should be logged; at compile time, only logs with literals having one of prefix1, ... as a prefix, should be generated. Moreover, also don't log "empty entries" (see below). To preserve the hierarchical context, also log headers of logging scopes. -}{- [Prefixed_or_result [| prefix1; ... |]] as above, but also log results of computations. At runtime doesn't output results of an entry if there are no non-result logs. -}{- [Prefixed [||]] is compile-time only -- outputs all and only explicit logs (i.e. [%log], [%log_result], [%log_printbox], [%log_entry] statements). -}{- [Prefixed_or_result [||]] at compile-time -- as above, but also log results of computations. -}{- [Prefixed_or_result [||]] at runtime -- only log results of computations if an entry has non-result logs. -}{- [Nonempty_entries] -- do not log subtrees, such as functions or control flow blocks, that do not have sub-logs. Exception: explicit [%log_entry] subtrees. -}{- [Everything] -- no restrictions. -}} - -The [%diagn_] extension points are a shorthand for setting the compile-time log level to [Prefixed [||]], or [Prefixed prefixes] when the log level has already been either [Prefixed prefixes] or [Prefixed_or_result prefixes]. Example from the test suite: +The log levels are integers intended to be within the range 0-9, where 0 means no logging at all. They can be provided explicitly by all extension entry points and all explicit logging extensions. When omitted, the log level of the enclosing log entry is used; the default for a top-level log entry is log level 1. + +The [%diagn_] extension points further restrict logging to explicit logs only. Example from the test suite: {@ocaml[ let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in diff --git a/minidebug_runtime.ml b/minidebug_runtime.ml index 91b4977..a053bf1 100644 --- a/minidebug_runtime.ml +++ b/minidebug_runtime.ml @@ -34,21 +34,6 @@ type location_format = | Range_line | Range_pos -type log_level = - | Nothing - | Prefixed of string array - | Prefixed_or_result of string array - | Nonempty_entries - | Everything - -let equal_log_level l1 l2 = - match (l1, l2) with - | (Prefixed p1, Prefixed p2 | Prefixed_or_result p1, Prefixed_or_result p2) - when Array.for_all2 String.equal p1 p2 -> - true - | Nothing, Nothing | Nonempty_entries, Nonempty_entries | Everything, Everything -> true - | _ -> false - type toc_entry_criteria = | Minimal_depth of int | Minimal_size of int @@ -66,8 +51,6 @@ let toc_entry_passes ~depth ~size ~span criteria = in loop criteria -let is_prefixed_or_result = function Prefixed_or_result _ -> true | _ -> false - module type Shared_config = sig val refresh_ch : unit -> bool val debug_ch : unit -> out_channel @@ -187,23 +170,32 @@ module type Debug_runtime = sig end_colnum:int -> message:string -> entry_id:int -> + log_level:int -> unit - val open_log_no_source : message:string -> entry_id:int -> unit + val open_log_no_source : message:string -> entry_id:int -> log_level:int -> unit val log_value_sexp : - ?descr:string -> entry_id:int -> is_result:bool -> Sexplib0.Sexp.t -> unit + ?descr:string -> + entry_id:int -> + log_level:int -> + is_result:bool -> + Sexplib0.Sexp.t -> + unit val log_value_pp : ?descr:string -> entry_id:int -> + log_level:int -> pp:(Format.formatter -> 'a -> unit) -> is_result:bool -> 'a -> unit - val log_value_show : ?descr:string -> entry_id:int -> is_result:bool -> string -> unit - val log_value_printbox : entry_id:int -> PrintBox.t -> unit + val log_value_show : + ?descr:string -> entry_id:int -> log_level:int -> is_result:bool -> string -> unit + + val log_value_printbox : entry_id:int -> log_level:int -> PrintBox.t -> unit val exceeds_max_nesting : unit -> bool val exceeds_max_children : unit -> bool val get_entry_id : unit -> int @@ -213,6 +205,7 @@ module type Debug_runtime = sig val snapshot : unit -> unit val description : string val no_debug_if : bool -> unit + val log_level : int ref end let exceeds ~value ~limit = match limit with None -> false | Some limit -> limit < value @@ -243,6 +236,7 @@ let opt_verbose_entry_id ~verbose_entry_ids ~entry_id = module Flushing (Log_to : Shared_config) : Debug_runtime = struct open Log_to + let log_level = ref 9 let max_nesting_depth = ref None let max_num_children = ref None let debug_ch = ref @@ debug_ch () @@ -256,7 +250,9 @@ module Flushing (Log_to : Shared_config) : Debug_runtime = struct entry_id : int; } + let check_log_level level = level <= !log_level let stack = ref [] + let hidden_entries = ref [] let depth_stack = ref [] let indent () = String.make (List.length !stack) ' ' @@ -274,14 +270,15 @@ module Flushing (Log_to : Shared_config) : Debug_runtime = struct (timestamp_to_string ()) let close_log ~fname ~start_lnum ~entry_id = - match !stack with - | [] -> + match (!hidden_entries, !stack) with + | hidden_id :: tl, _ when hidden_id = entry_id -> hidden_entries := tl + | _, [] -> let log_loc = Printf.sprintf "%s\"%s\":%d: entry_id=%d" global_prefix fname start_lnum entry_id in failwith @@ "ppx_minidebug: close_log must follow an earlier open_log; " ^ log_loc - | { message; elapsed; time_tag; entry_id = open_entry_id; _ } :: tl -> ( + | _, { message; elapsed; time_tag; entry_id = open_entry_id; _ } :: tl -> ( let elapsed_on_close = time_elapsed () in stack := tl; (if open_entry_id <> entry_id then @@ -323,46 +320,52 @@ module Flushing (Log_to : Shared_config) : Debug_runtime = struct | (cur_depth, cur_size) :: (depth, size) :: tl -> depth_stack := (max depth (cur_depth + 1), cur_size + size) :: tl) - let open_log ~fname ~start_lnum ~start_colnum ~end_lnum ~end_colnum ~message ~entry_id = - Printf.fprintf !debug_ch "%s%s%s%s begin %!" (indent ()) global_prefix - (opt_entry_id ~print_entry_ids ~entry_id) - message; - let message = opt_verbose_entry_id ~verbose_entry_ids ~entry_id ^ message in - (match Log_to.location_format with - | No_location -> () - | File_only -> Printf.fprintf !debug_ch "\"%s\":%!" fname - | Beg_line -> Printf.fprintf !debug_ch "\"%s\":%d:%!" fname start_lnum - | Beg_pos -> Printf.fprintf !debug_ch "\"%s\":%d:%d:%!" fname start_lnum start_colnum - | Range_line -> Printf.fprintf !debug_ch "\"%s\":%d-%d:%!" fname start_lnum end_lnum - | Range_pos -> - Printf.fprintf !debug_ch "\"%s\":%d:%d-%d:%d:%!" fname start_lnum start_colnum - end_lnum end_colnum); - let time_tag = - match Log_to.time_tagged with - | Not_tagged -> "" - | Clock -> " " ^ timestamp_to_string () - | Elapsed -> Format.asprintf " %a" pp_elapsed () - in - Printf.fprintf !debug_ch "%s\n%!" time_tag; - stack := - { message; elapsed = time_elapsed (); time_tag; num_children = 0; entry_id } - :: !stack - - let open_log_no_source ~message ~entry_id = - Printf.fprintf !debug_ch "%s%s%s%s begin %!" (indent ()) global_prefix - (opt_entry_id ~print_entry_ids ~entry_id) - message; - let message = opt_verbose_entry_id ~verbose_entry_ids ~entry_id ^ message in - let time_tag = - match Log_to.time_tagged with - | Not_tagged -> "" - | Clock -> " " ^ timestamp_to_string () - | Elapsed -> Format.asprintf " %a" pp_elapsed () - in - Printf.fprintf !debug_ch "%s\n%!" time_tag; - stack := - { message; elapsed = time_elapsed (); time_tag; num_children = 0; entry_id } - :: !stack + let open_log ~fname ~start_lnum ~start_colnum ~end_lnum ~end_colnum ~message ~entry_id + ~log_level = + if check_log_level log_level then ( + let message = opt_verbose_entry_id ~verbose_entry_ids ~entry_id ^ message in + let time_tag = + match Log_to.time_tagged with + | Not_tagged -> "" + | Clock -> " " ^ timestamp_to_string () + | Elapsed -> Format.asprintf " %a" pp_elapsed () + in + Printf.fprintf !debug_ch "%s%s%s%s begin %!" (indent ()) global_prefix + (opt_entry_id ~print_entry_ids ~entry_id) + message; + stack := + { message; elapsed = time_elapsed (); time_tag; num_children = 0; entry_id } + :: !stack; + (match Log_to.location_format with + | No_location -> () + | File_only -> Printf.fprintf !debug_ch "\"%s\":%!" fname + | Beg_line -> Printf.fprintf !debug_ch "\"%s\":%d:%!" fname start_lnum + | Beg_pos -> + Printf.fprintf !debug_ch "\"%s\":%d:%d:%!" fname start_lnum start_colnum + | Range_line -> Printf.fprintf !debug_ch "\"%s\":%d-%d:%!" fname start_lnum end_lnum + | Range_pos -> + Printf.fprintf !debug_ch "\"%s\":%d:%d-%d:%d:%!" fname start_lnum start_colnum + end_lnum end_colnum); + Printf.fprintf !debug_ch "%s\n%!" time_tag) + else hidden_entries := entry_id :: !hidden_entries + + let open_log_no_source ~message ~entry_id ~log_level = + if check_log_level log_level then ( + let message = opt_verbose_entry_id ~verbose_entry_ids ~entry_id ^ message in + let time_tag = + match Log_to.time_tagged with + | Not_tagged -> "" + | Clock -> " " ^ timestamp_to_string () + | Elapsed -> Format.asprintf " %a" pp_elapsed () + in + Printf.fprintf !debug_ch "%s%s%s%s begin %!" (indent ()) global_prefix + (opt_entry_id ~print_entry_ids ~entry_id) + message; + stack := + { message; elapsed = time_elapsed (); time_tag; num_children = 0; entry_id } + :: !stack; + Printf.fprintf !debug_ch "%s\n%!" time_tag) + else hidden_entries := entry_id :: !hidden_entries let bump_stack_entry entry_id = match !stack with @@ -371,32 +374,36 @@ module Flushing (Log_to : Shared_config) : Debug_runtime = struct "" | [] -> "{orphaned from #" ^ Int.to_string entry_id ^ "} " - let log_value_sexp ?descr ~entry_id ~is_result:_ sexp = - let orphaned = bump_stack_entry entry_id in - let descr = match descr with None -> "" | Some d -> d ^ " = " in - Printf.fprintf !debug_ch "%s%s%s%s\n%!" (indent ()) orphaned descr - (Sexplib0.Sexp.to_string_hum sexp) - - let log_value_pp ?descr ~entry_id ~pp ~is_result:_ v = - let orphaned = bump_stack_entry entry_id in - let descr = match descr with None -> "" | Some d -> d ^ " = " in - let _ = CFormat.flush_str_formatter () in - pp CFormat.str_formatter v; - let v_str = CFormat.flush_str_formatter () in - Printf.fprintf !debug_ch "%s%s%s%s\n%!" (indent ()) orphaned descr v_str - - let log_value_show ?descr ~entry_id ~is_result:_ v = - let orphaned = bump_stack_entry entry_id in - let descr = match descr with None -> "" | Some d -> d ^ " = " in - Printf.fprintf !debug_ch "%s%s%s%s\n%!" (indent ()) orphaned descr v - - let log_value_printbox ~entry_id v = - let orphaned = bump_stack_entry entry_id in - let orphaned = if orphaned = "" then "" else " " ^ orphaned in - let indent = indent () in - Printf.fprintf !debug_ch "%a%s\n%!" - (PrintBox_text.output ?style:None ~indent:(String.length indent)) - v orphaned + let log_value_sexp ?descr ~entry_id ~log_level ~is_result:_ sexp = + if check_log_level log_level then + let orphaned = bump_stack_entry entry_id in + let descr = match descr with None -> "" | Some d -> d ^ " = " in + Printf.fprintf !debug_ch "%s%s%s%s\n%!" (indent ()) orphaned descr + (Sexplib0.Sexp.to_string_hum sexp) + + let log_value_pp ?descr ~entry_id ~log_level ~pp ~is_result:_ v = + if check_log_level log_level then ( + let orphaned = bump_stack_entry entry_id in + let descr = match descr with None -> "" | Some d -> d ^ " = " in + let _ = CFormat.flush_str_formatter () in + pp CFormat.str_formatter v; + let v_str = CFormat.flush_str_formatter () in + Printf.fprintf !debug_ch "%s%s%s%s\n%!" (indent ()) orphaned descr v_str) + + let log_value_show ?descr ~entry_id ~log_level ~is_result:_ v = + if check_log_level log_level then + let orphaned = bump_stack_entry entry_id in + let descr = match descr with None -> "" | Some d -> d ^ " = " in + Printf.fprintf !debug_ch "%s%s%s%s\n%!" (indent ()) orphaned descr v + + let log_value_printbox ~entry_id ~log_level v = + if check_log_level log_level then + let orphaned = bump_stack_entry entry_id in + let orphaned = if orphaned = "" then "" else " " ^ orphaned in + let indent = indent () in + Printf.fprintf !debug_ch "%a%s\n%!" + (PrintBox_text.output ?style:None ~indent:(String.length indent)) + v orphaned let exceeds_max_nesting () = exceeds ~value:(List.length !stack) ~limit:!max_nesting_depth @@ -437,7 +444,6 @@ module type PrintBox_runtime = sig mutable values_first_mode : bool; mutable max_inline_sexp_size : int; mutable max_inline_sexp_length : int; - mutable log_level : log_level; mutable snapshot_every_sec : float option; mutable sexp_unescape_strings : bool; mutable with_toc_listing : bool; @@ -462,8 +468,10 @@ let anchor_entry_id ~is_pure_text ~entry_id = module PrintBox (Log_to : Shared_config) = struct open Log_to + let log_level = ref 9 let max_nesting_depth = ref None let max_num_children = ref None + let check_log_level level = level <= !log_level type config = { mutable hyperlink : [ `Prefix of string | `No_hyperlinks ]; @@ -478,7 +486,6 @@ module PrintBox (Log_to : Shared_config) = struct mutable values_first_mode : bool; mutable max_inline_sexp_size : int; mutable max_inline_sexp_length : int; - mutable log_level : log_level; mutable snapshot_every_sec : float option; mutable sexp_unescape_strings : bool; mutable with_toc_listing : bool; @@ -499,7 +506,6 @@ module PrintBox (Log_to : Shared_config) = struct values_first_mode = false; max_inline_sexp_size = 20; max_inline_sexp_length = 80; - log_level = Everything; snapshot_every_sec = None; sexp_unescape_strings = true; toc_flame_graph = false; @@ -519,7 +525,7 @@ module PrintBox (Log_to : Shared_config) = struct } type entry = { - cond : bool; + no_debug_if : bool; highlight : bool; exclude : bool; elapsed : Mtime.span; @@ -535,6 +541,7 @@ module PrintBox (Log_to : Shared_config) = struct } let stack : entry list ref = ref [] + let hidden_entries = ref [] let hyperlink_path ~uri ~inner = match config.hyperlink with @@ -586,7 +593,7 @@ module PrintBox (Log_to : Shared_config) = struct let stack_to_tree ~elapsed_on_close { - cond = _; + no_debug_if; highlight; exclude = _; elapsed; @@ -600,6 +607,7 @@ module PrintBox (Log_to : Shared_config) = struct toc_depth = _; size = _; } = + assert (not no_debug_if); let non_id_message = (* Being defensive: checking for '=' not required so far. *) String.contains entry_message '<' @@ -890,14 +898,15 @@ module PrintBox (Log_to : Shared_config) = struct (* Design choice: exclude does not apply to its own entry -- it's about propagating children. *) match !stack with + | { no_debug_if = true; _ } :: bs -> bs | { highlight = false; _ } :: bs when config.prune_upto >= List.length !stack -> bs - | { body = []; _ } :: bs when config.log_level <> Everything -> bs - | { body; _ } :: bs - when is_prefixed_or_result config.log_level - && List.for_all (fun e -> e.is_result) body -> + (* FIXME: rethink and explain this in the README: log level 3 for empty bodies, log + level 2 for non-explicit-content-only bodies. *) + | { body = []; _ } :: bs when !log_level < 3 -> bs + | { body; _ } :: bs when !log_level < 2 && List.for_all (fun e -> e.is_result) body + -> bs | ({ - cond = true; highlight = hl; exclude = _; entry_id = result_id; @@ -907,7 +916,7 @@ module PrintBox (Log_to : Shared_config) = struct _; } as entry) :: { - cond; + no_debug_if; highlight; exclude; uri; @@ -932,7 +941,7 @@ module PrintBox (Log_to : Shared_config) = struct else "" in { - cond; + no_debug_if; highlight = highlight || ((not exclude) && hl); exclude; uri; @@ -958,15 +967,17 @@ module PrintBox (Log_to : Shared_config) = struct size = result_size + size; } :: bs3 - | { cond = false; _ } :: bs -> bs - | [ ({ cond = true; toc_depth; _ } as entry) ] -> + | [ ({ toc_depth; _ } as entry) ] -> close_tree ~entry ~toc_depth; [] | [] -> assert false let close_log ~fname ~start_lnum ~entry_id = - let elapsed_on_close = time_elapsed () in - close_log_impl ~from_snapshot:false ~elapsed_on_close ~fname ~start_lnum ~entry_id + match !hidden_entries with + | hidden_id :: tl when hidden_id = entry_id -> hidden_entries := tl + | _ -> + let elapsed_on_close = time_elapsed () in + close_log_impl ~from_snapshot:false ~elapsed_on_close ~fname ~start_lnum ~entry_id let snapshot () = let current_stack = !stack in @@ -997,7 +1008,7 @@ module PrintBox (Log_to : Shared_config) = struct last_snapshot := now; snapshot ()) - let stack_next ~entry_id ~is_result ~prefixed ~result_depth ~result_size (hl, b) = + let stack_next ~entry_id ~is_result ~result_depth ~result_size (hl, b) = let opt_eid = opt_verbose_entry_id ~verbose_entry_ids ~entry_id in let rec eid b = match B.view b with @@ -1013,36 +1024,13 @@ module PrintBox (Log_to : Shared_config) = struct | B.Anchor { id; inner } -> B.anchor ~id @@ eid inner in let b = if opt_eid = "" then b else eid b in - match config.log_level with - | Nothing -> () - | Prefixed _ when not prefixed -> () - | Prefixed_or_result _ when not (is_result || prefixed) -> () - | _ -> ( - match !stack with - | ({ highlight; exclude; body; depth; size; elapsed; _ } as entry) :: bs2 -> - stack := - { - entry with - highlight = highlight || ((not exclude) && hl); - body = - { - result_id = entry_id; - is_result; - highlighted = hl; - elapsed_start = elapsed; - elapsed_end = elapsed; - subtree = b; - toc_subtree = B.empty; - flame_subtree = ""; - } - :: body; - depth = max (result_depth + 1) depth; - size = size + result_size; - } - :: bs2 - | [] -> - let elapsed = time_elapsed () in - let subentry = + match !stack with + | ({ highlight; exclude; body; depth; size; elapsed; _ } as entry) :: bs2 -> + stack := + { + entry with + highlight = highlight || ((not exclude) && hl); + body = { result_id = entry_id; is_result; @@ -1053,115 +1041,138 @@ module PrintBox (Log_to : Shared_config) = struct toc_subtree = B.empty; flame_subtree = ""; } - in - let entry_message = "{orphaned from #" ^ Int.to_string entry_id ^ "}" in - stack := - [ - { - cond = true; - highlight = hl; - exclude = false; - elapsed; - time_tag = ""; - uri = ""; - path = ""; - entry_message; - entry_id = -1; - body = [ subentry ]; - depth = 1; - toc_depth = 0; - size = 1; - }; - ]; - close_log ~fname:"orphaned" ~start_lnum:entry_id ~entry_id:(-1)) - - let open_log ~fname ~start_lnum ~start_colnum ~end_lnum ~end_colnum ~message ~entry_id = - let elapsed = time_elapsed () in - let uri = - match config.hyperlink with - | `Prefix prefix - when String.length prefix = 0 - || Char.equal prefix.[0] '.' - || String.length prefix > 6 - && (String.equal (String.sub prefix 0 5) "http:" - || String.equal (String.sub prefix 0 6) "https:") -> - Printf.sprintf "%s#L%d" fname start_lnum - | _ -> Printf.sprintf "%s:%d:%d" fname start_lnum (start_colnum + 1) - in - let location = - match Log_to.location_format with - | No_location -> "" - | File_only -> Printf.sprintf "\"%s\":" fname - | Beg_line -> Printf.sprintf "\"%s\":%d" fname start_lnum - | Beg_pos -> Printf.sprintf "\"%s\":%d:%d" fname start_lnum start_colnum - | Range_line -> Format.asprintf "\"%s\":%d-%d" fname start_lnum end_lnum - | Range_pos -> - Format.asprintf "\"%s\":%d:%d-%d:%d" fname start_lnum start_colnum end_lnum - end_colnum - in - let time_tag = - match time_tagged with - | Not_tagged -> "" - | Clock -> Format.asprintf " at time %a" pp_timestamp () - | Elapsed -> Format.asprintf " at elapsed %a" pp_elapsed () - in - let path = location ^ time_tag in - let exclude = - match config.exclude_on_path with Some r -> Re.execp r message | None -> false - in - let highlight = - match config.highlight_terms with Some r -> Re.execp r message | None -> false - in - let entry_message = global_prefix ^ message in - stack := - { - cond = true; - highlight; - exclude; - uri; - path; - elapsed; - time_tag; - entry_message; - entry_id; - body = []; - depth = 0; - toc_depth = 0; - size = 1; - } - :: !stack - - let open_log_no_source ~message ~entry_id = - let time_tag = - match time_tagged with - | Not_tagged -> "" - | Clock -> Format.asprintf " at time %a" pp_timestamp () - | Elapsed -> Format.asprintf " at elapsed %a" pp_elapsed () - in - let exclude = - match config.exclude_on_path with Some r -> Re.execp r message | None -> false - in - let highlight = - match config.highlight_terms with Some r -> Re.execp r message | None -> false - in - let entry_message = global_prefix ^ message in - stack := - { - cond = true; - highlight; - exclude; - uri = ""; - path = ""; - elapsed = time_elapsed (); - time_tag; - entry_message; - entry_id; - body = []; - depth = 0; - toc_depth = 0; - size = 1; - } - :: !stack + :: body; + depth = max (result_depth + 1) depth; + size = size + result_size; + } + :: bs2 + | [] -> + let elapsed = time_elapsed () in + let subentry = + { + result_id = entry_id; + is_result; + highlighted = hl; + elapsed_start = elapsed; + elapsed_end = elapsed; + subtree = b; + toc_subtree = B.empty; + flame_subtree = ""; + } + in + let entry_message = "{orphaned from #" ^ Int.to_string entry_id ^ "}" in + stack := + [ + { + no_debug_if = false; + highlight = hl; + exclude = false; + elapsed; + time_tag = ""; + uri = ""; + path = ""; + entry_message; + entry_id = -1; + body = [ subentry ]; + depth = 1; + toc_depth = 0; + size = 1; + }; + ]; + close_log ~fname:"orphaned" ~start_lnum:entry_id ~entry_id:(-1) + + let open_log ~fname ~start_lnum ~start_colnum ~end_lnum ~end_colnum ~message ~entry_id + ~log_level = + if check_log_level log_level then + let elapsed = time_elapsed () in + let uri = + match config.hyperlink with + | `Prefix prefix + when String.length prefix = 0 + || Char.equal prefix.[0] '.' + || String.length prefix > 6 + && (String.equal (String.sub prefix 0 5) "http:" + || String.equal (String.sub prefix 0 6) "https:") -> + Printf.sprintf "%s#L%d" fname start_lnum + | _ -> Printf.sprintf "%s:%d:%d" fname start_lnum (start_colnum + 1) + in + let location = + match Log_to.location_format with + | No_location -> "" + | File_only -> Printf.sprintf "\"%s\":" fname + | Beg_line -> Printf.sprintf "\"%s\":%d" fname start_lnum + | Beg_pos -> Printf.sprintf "\"%s\":%d:%d" fname start_lnum start_colnum + | Range_line -> Format.asprintf "\"%s\":%d-%d" fname start_lnum end_lnum + | Range_pos -> + Format.asprintf "\"%s\":%d:%d-%d:%d" fname start_lnum start_colnum end_lnum + end_colnum + in + let time_tag = + match time_tagged with + | Not_tagged -> "" + | Clock -> Format.asprintf " at time %a" pp_timestamp () + | Elapsed -> Format.asprintf " at elapsed %a" pp_elapsed () + in + let path = location ^ time_tag in + let exclude = + match config.exclude_on_path with Some r -> Re.execp r message | None -> false + in + let highlight = + match config.highlight_terms with Some r -> Re.execp r message | None -> false + in + let entry_message = global_prefix ^ message in + stack := + { + no_debug_if = false; + highlight; + exclude; + uri; + path; + elapsed; + time_tag; + entry_message; + entry_id; + body = []; + depth = 0; + toc_depth = 0; + size = 1; + } + :: !stack + else hidden_entries := entry_id :: !hidden_entries + + let open_log_no_source ~message ~entry_id ~log_level = + if check_log_level log_level then + let time_tag = + match time_tagged with + | Not_tagged -> "" + | Clock -> Format.asprintf " at time %a" pp_timestamp () + | Elapsed -> Format.asprintf " at elapsed %a" pp_elapsed () + in + let exclude = + match config.exclude_on_path with Some r -> Re.execp r message | None -> false + in + let highlight = + match config.highlight_terms with Some r -> Re.execp r message | None -> false + in + let entry_message = global_prefix ^ message in + stack := + { + no_debug_if = false; + highlight; + exclude; + uri = ""; + path = ""; + elapsed = time_elapsed (); + time_tag; + entry_message; + entry_id; + body = []; + depth = 0; + toc_depth = 0; + size = 1; + } + :: !stack + else hidden_entries := entry_id :: !hidden_entries let sexp_size sexp = let open Sexplib0.Sexp in @@ -1241,98 +1252,50 @@ module PrintBox (Log_to : Shared_config) = struct let num_children () = match !stack with [] -> 0 | { body; _ } :: _ -> List.length body - let log_value_sexp ?descr ~entry_id ~is_result sexp = - let prefixed = - match config.log_level with - | Prefixed_or_result [||] -> true - | Prefixed [||] -> - failwith "ppx_minidebug: runtime log levels do not support explicit-logs-only" - | Prefixed prefixes | Prefixed_or_result prefixes -> - let rec loop = function - | Sexplib0.Sexp.Atom s -> - Array.exists (fun prefix -> String.starts_with ~prefix s) prefixes - | List [] -> false - | List (e :: _) -> loop e - in - loop sexp - | _ -> true - in - (if config.boxify_sexp_from_size >= 0 then - stack_next ~entry_id ~is_result ~prefixed ~result_depth:0 ~result_size:1 - @@ boxify ?descr sexp - else - stack_next ~entry_id ~is_result ~prefixed ~result_depth:0 ~result_size:1 - @@ highlight_box - @@ - match descr with - | None -> B.asprintf_with_style B.Style.preformatted "%a" pp_sexp sexp - | Some d -> B.asprintf_with_style B.Style.preformatted "%s = %a" d pp_sexp sexp); - opt_auto_snapshot () - - let skip_parens s = - let len = String.length s in - let pos = ref 0 in - while !pos < len && (s.[!pos] = '(' || s.[!pos] = '{' || s.[!pos] = '[') do - incr pos - done; - let s = String.(sub s !pos @@ (length s - !pos)) in - s - - let log_value_pp ?descr ~entry_id ~pp ~is_result v = - let prefixed = - match config.log_level with - | Prefixed_or_result [||] -> true - | Prefixed [||] -> - failwith "ppx_minidebug: runtime log levels do not support explicit-logs-only" - | Prefixed prefixes | Prefixed_or_result prefixes -> - (* TODO: perf-hint: cache this conversion and maybe don't re-convert. *) - let s = skip_parens @@ Format.asprintf "%a" pp v in - Array.exists (fun prefix -> String.starts_with ~prefix s) prefixes - | _ -> true - in - (stack_next ~entry_id ~is_result ~prefixed ~result_depth:0 ~result_size:1 - @@ highlight_box - @@ - match descr with - | None -> B.asprintf_with_style B.Style.preformatted "%a" pp v - | Some d -> B.asprintf_with_style B.Style.preformatted "%s = %a" d pp v); - opt_auto_snapshot () - - let log_value_show ?descr ~entry_id ~is_result v = - let prefixed = - match config.log_level with - | Prefixed_or_result [||] -> true - | Prefixed [||] -> - failwith "ppx_minidebug: runtime log levels do not support explicit-logs-only" - | Prefixed prefixes | Prefixed_or_result prefixes -> - let s = skip_parens v in - Array.exists (fun prefix -> String.starts_with ~prefix s) prefixes - | _ -> true - in - (stack_next ~entry_id ~is_result ~prefixed ~result_depth:0 ~result_size:1 - @@ highlight_box - @@ - match descr with - | None -> B.sprintf_with_style B.Style.preformatted "%s" v - | Some d -> B.sprintf_with_style B.Style.preformatted "%s = %s" d v); - opt_auto_snapshot () - - let log_value_printbox ~entry_id v = - let prefixed = - match config.log_level with - | Prefixed_or_result [||] -> true - | Prefixed [||] -> true - | Prefixed _ | Prefixed_or_result _ -> false - | _ -> true - in - stack_next ~entry_id ~is_result:false ~prefixed ~result_depth:0 ~result_size:1 - @@ highlight_box v; - opt_auto_snapshot () + let log_value_sexp ?descr ~entry_id ~log_level ~is_result sexp = + if check_log_level log_level then ( + (if config.boxify_sexp_from_size >= 0 then + stack_next ~entry_id ~is_result ~result_depth:0 ~result_size:1 + @@ boxify ?descr sexp + else + stack_next ~entry_id ~is_result ~result_depth:0 ~result_size:1 + @@ highlight_box + @@ + match descr with + | None -> B.asprintf_with_style B.Style.preformatted "%a" pp_sexp sexp + | Some d -> B.asprintf_with_style B.Style.preformatted "%s = %a" d pp_sexp sexp); + opt_auto_snapshot ()) + + let log_value_pp ?descr ~entry_id ~log_level ~pp ~is_result v = + if check_log_level log_level then ( + (stack_next ~entry_id ~is_result ~result_depth:0 ~result_size:1 + @@ highlight_box + @@ + match descr with + | None -> B.asprintf_with_style B.Style.preformatted "%a" pp v + | Some d -> B.asprintf_with_style B.Style.preformatted "%s = %a" d pp v); + opt_auto_snapshot ()) + + let log_value_show ?descr ~entry_id ~log_level ~is_result v = + if check_log_level log_level then ( + (stack_next ~entry_id ~is_result ~result_depth:0 ~result_size:1 + @@ highlight_box + @@ + match descr with + | None -> B.sprintf_with_style B.Style.preformatted "%s" v + | Some d -> B.sprintf_with_style B.Style.preformatted "%s = %s" d v); + opt_auto_snapshot ()) + + let log_value_printbox ~entry_id ~log_level v = + if check_log_level log_level then ( + stack_next ~entry_id ~is_result:false ~result_depth:0 ~result_size:1 + @@ highlight_box v; + opt_auto_snapshot ()) let no_debug_if cond = match !stack with - | ({ cond = true; _ } as entry) :: bs when cond -> - stack := { entry with cond = false } :: bs + | ({ no_debug_if = false; _ } as entry) :: bs when cond -> + stack := { entry with no_debug_if = true } :: bs | _ -> () let exceeds_max_nesting () = @@ -1357,7 +1320,7 @@ let debug_file ?(time_tagged = Not_tagged) ?(elapsed_times = elapsed_default) ?highlight_terms ?exclude_on_path ?(prune_upto = 0) ?(truncate_children = 0) ?(for_append = false) ?(boxify_sexp_from_size = 50) ?(max_inline_sexp_length = 80) ?backend ?hyperlink ?toc_specific_hyperlink ?(values_first_mode = false) - ?(log_level = Everything) ?snapshot_every_sec filename : (module PrintBox_runtime) = + ?(log_level = 9) ?snapshot_every_sec filename : (module PrintBox_runtime) = let filename = match backend with | None | Some (`Markdown _) -> filename ^ ".md" @@ -1381,7 +1344,7 @@ let debug_file ?(time_tagged = Not_tagged) ?(elapsed_times = elapsed_default) Debug.config.hyperlink <- (match hyperlink with None -> `No_hyperlinks | Some prefix -> `Prefix prefix); Debug.config.toc_specific_hyperlink <- toc_specific_hyperlink; - Debug.config.log_level <- log_level; + Debug.log_level := log_level; Debug.config.snapshot_every_sec <- snapshot_every_sec; Debug.config.with_toc_listing <- with_toc_listing; if toc_flame_graph && backend = Some `Text then @@ -1395,7 +1358,7 @@ let debug ?debug_ch ?(time_tagged = Not_tagged) ?(elapsed_times = elapsed_defaul ?(location_format = Beg_pos) ?(print_entry_ids = false) ?(verbose_entry_ids = false) ?description ?(global_prefix = "") ?table_of_contents_ch ?(toc_entry = And []) ?highlight_terms ?exclude_on_path ?(prune_upto = 0) ?(truncate_children = 0) - ?toc_specific_hyperlink ?(values_first_mode = false) ?(log_level = Everything) + ?toc_specific_hyperlink ?(values_first_mode = false) ?(log_level = 9) ?snapshot_every_sec () : (module PrintBox_runtime) = let module Debug = PrintBox (struct let refresh_ch () = false @@ -1439,7 +1402,7 @@ let debug ?debug_ch ?(time_tagged = Not_tagged) ?(elapsed_times = elapsed_defaul Debug.config.truncate_children <- truncate_children; Debug.config.exclude_on_path <- Option.map Re.compile exclude_on_path; Debug.config.values_first_mode <- values_first_mode; - Debug.config.log_level <- log_level; + Debug.log_level := log_level; Debug.config.snapshot_every_sec <- snapshot_every_sec; Debug.config.toc_specific_hyperlink <- toc_specific_hyperlink; (module Debug) @@ -1448,8 +1411,8 @@ let debug_flushing ?debug_ch:d_ch ?table_of_contents_ch ?filename ?(time_tagged = Not_tagged) ?(elapsed_times = elapsed_default) ?(location_format = Beg_pos) ?(print_entry_ids = false) ?(verbose_entry_ids = false) ?description ?(global_prefix = "") ?split_files_after - ?(with_table_of_contents = false) ?(toc_entry = And []) ?(for_append = false) () : - (module Debug_runtime) = + ?(with_table_of_contents = false) ?(toc_entry = And []) ?(for_append = false) + ?(log_level = 9) () : (module Debug_runtime) = let log_to = match (filename, d_ch) with | None, _ -> @@ -1506,7 +1469,9 @@ let debug_flushing ?debug_ch:d_ch ?table_of_contents_ch ?filename "Minidebug_runtime.debug_flushing: only one of debug_ch, filename should be \ provided" in - (module Flushing ((val log_to))) + let module Debug = Flushing ((val log_to)) in + Debug.log_level := log_level; + (module Debug) let forget_printbox (module Runtime : PrintBox_runtime) = (module Runtime : Debug_runtime) diff --git a/minidebug_runtime.mli b/minidebug_runtime.mli index cd9d2ec..5244feb 100644 --- a/minidebug_runtime.mli +++ b/minidebug_runtime.mli @@ -13,26 +13,6 @@ type location_format = | Range_line | Range_pos -(** The log levels, for both (in scope) compile time, and for the PrintBox runtime. When - considered at compile time, inspecting strings requires string literals, at runtime it - applies to all string values. Not logging at compile time means the corresponding - loggingcode is not generated; not logging at runtime means the logging state is not - updated. *) -type log_level = - | Nothing (** Does not log anything. *) - | Prefixed of string array - (** Behaves as [Nonempty_entries] and additionally: only logs "leaf" values when the - inspected string starts with one of the prefixes. *) - | Prefixed_or_result of string array - (** Behaves as [Nonempty_entries] and additionally: only logs "leaf" values when the - inspected string starts with one of the prefixes, or the value is marked as a - result. Doesn't output results of an entry if there are no non-result logs. *) - | Nonempty_entries - (** Does not log entries without children (treating results as children). *) - | Everything (** Does not restrict logging. *) - -val equal_log_level : log_level -> log_level -> bool - type toc_entry_criteria = | Minimal_depth of int | Minimal_size of int @@ -115,23 +95,32 @@ module type Debug_runtime = sig end_colnum:int -> message:string -> entry_id:int -> + log_level:int -> unit - val open_log_no_source : message:string -> entry_id:int -> unit + val open_log_no_source : message:string -> entry_id:int -> log_level:int -> unit val log_value_sexp : - ?descr:string -> entry_id:int -> is_result:bool -> Sexplib0.Sexp.t -> unit + ?descr:string -> + entry_id:int -> + log_level:int -> + is_result:bool -> + Sexplib0.Sexp.t -> + unit val log_value_pp : ?descr:string -> entry_id:int -> + log_level:int -> pp:(Format.formatter -> 'a -> unit) -> is_result:bool -> 'a -> unit - val log_value_show : ?descr:string -> entry_id:int -> is_result:bool -> string -> unit - val log_value_printbox : entry_id:int -> PrintBox.t -> unit + val log_value_show : + ?descr:string -> entry_id:int -> log_level:int -> is_result:bool -> string -> unit + + val log_value_printbox : entry_id:int -> log_level:int -> PrintBox.t -> unit val exceeds_max_nesting : unit -> bool val exceeds_max_children : unit -> bool val get_entry_id : unit -> int @@ -155,6 +144,13 @@ module type Debug_runtime = sig disables the logging of this subtree and its subtrees. Does not do anything when passed false ([no_debug_if false] does {e not} re-enable the log). Does nothing for the [Flushing] runtimes. *) + + val log_level : int ref + (** The runtime log level. + + The log levels are used both at compile time, and for the PrintBox runtime. Not + logging at compile time means the corresponding logging code is not generated; not + logging at runtime means the logging state is not updated. *) end (** The output is flushed line-at-a-time, so no output should be lost if the traced @@ -215,7 +211,6 @@ module type PrintBox_runtime = sig mutable max_inline_sexp_length : int; (** Maximal length (in characters/bytes) up to which a sexp value can be inlined during "boxification". *) - mutable log_level : log_level; (** How much to log, see {!type:log_level}. *) mutable snapshot_every_sec : float option; (** If given, output a snapshot of the pending logs when at least the given time (in seconds) has passed since the previous output. This is only checked at @@ -269,7 +264,7 @@ val debug_file : ?hyperlink:string -> ?toc_specific_hyperlink:string -> ?values_first_mode:bool -> - ?log_level:log_level -> + ?log_level:int -> ?snapshot_every_sec:float -> string -> (module PrintBox_runtime) @@ -304,7 +299,7 @@ val debug : ?truncate_children:int -> ?toc_specific_hyperlink:string -> ?values_first_mode:bool -> - ?log_level:log_level -> + ?log_level:int -> ?snapshot_every_sec:float -> unit -> (module PrintBox_runtime) @@ -329,6 +324,7 @@ val debug_flushing : ?with_table_of_contents:bool -> ?toc_entry:toc_entry_criteria -> ?for_append:bool -> + ?log_level:int -> unit -> (module Debug_runtime) (** Creates a flushing-based debug runtime. By default it will log to [stdout] and will diff --git a/ppx_minidebug.ml b/ppx_minidebug.ml index fec40b0..b22f6d7 100644 --- a/ppx_minidebug.ml +++ b/ppx_minidebug.ml @@ -4,16 +4,6 @@ module A = Ast_builder.Default type log_value = Sexp | Show | Pp -type log_level = - | Nothing - | Prefixed of string array - | Prefixed_or_result of string array - | Nonempty_entries - | Everything - -let no_results = function Nothing | Prefixed _ -> true | _ -> false -let is_prefixed_or_result = function Prefixed_or_result _ -> true | _ -> false - type toplevel_opt_arg = | Nested | Toplevel_no_arg @@ -31,9 +21,12 @@ let global_log_count = ref 0 type context = { log_value : log_value; track_branches : bool; + restrict_to_explicit : bool; output_type_info : bool; interrupts : bool; - log_level : log_level; + comptime_log_level : int; + entry_log_level : int; + hidden : bool; toplevel_opt_arg : toplevel_opt_arg; } @@ -42,56 +35,25 @@ let init_context = { log_value = Sexp; track_branches = false; + restrict_to_explicit = false; output_type_info = false; interrupts = false; - log_level = Everything; + comptime_log_level = 9; + entry_log_level = 1; + hidden = false; toplevel_opt_arg = Toplevel_no_arg; } let parse_log_level ll = - let exception Error of expression in - let parse_prefixes exp = - match exp.pexp_desc with - | Pexp_array ps -> - Array.of_list - @@ List.map - (function - | { pexp_desc = Pexp_constant (Pconst_string (s, _, _)); _ } -> s - | p -> - let loc = p.pexp_loc in - raise - @@ Error - (A.pexp_extension ~loc - @@ Location.error_extensionf ~loc - "ppx_minidebug: expected a string literal with a log level \ - prefix")) - ps - | _ -> - let loc = exp.pexp_loc in - raise - @@ Error - (A.pexp_extension ~loc - @@ Location.error_extensionf ~loc - "ppx_minidebug: expected an array literal with log level prefixes") - in match ll with - | [%expr Nothing] | [%expr Minidebug_runtime.Nothing] -> Either.Left Nothing - | [%expr Prefixed [%e? prefixes]] | [%expr Minidebug_runtime.Prefixed [%e? prefixes]] - -> ( - try Left (Prefixed (parse_prefixes prefixes)) with Error e -> Right e) - | [%expr Prefixed_or_result [%e? prefixes]] - | [%expr Minidebug_runtime.Prefixed_or_result [%e? prefixes]] -> ( - try Left (Prefixed_or_result (parse_prefixes prefixes)) with Error e -> Right e) - | [%expr Nonempty_entries] | [%expr Minidebug_runtime.Nonempty_entries] -> - Left Nonempty_entries - | [%expr Everything] | [%expr Minidebug_runtime.Everything] -> Left Everything + | { pexp_desc = Pexp_constant (Pconst_integer (i, None)); _ } -> + Either.Left (int_of_string i) | _ -> let loc = ll.pexp_loc in Right (A.pexp_extension ~loc @@ Location.error_extensionf ~loc - "ppx_minidebug: expected one of: Nothing, Prefixed [|...|], \ - Prefixed_or_result [|...|], Nonempty_entries, Everything") + "ppx_minidebug: expected log level: an integer without a letter suffix") let rec last_ident = function | Lident id -> id @@ -173,7 +135,7 @@ let rec pat2expr pat = @@ Location.error_extensionf ~loc "ppx_minidebug requires a pattern identifier here: try using an `as` alias." -let open_log ?(message = "") ~loc () = +let open_log ?(message = "") ~loc ~log_level () = if String.contains message '\n' then A.pexp_extension ~loc @@ Location.error_extensionf ~loc @@ -187,10 +149,13 @@ let open_log ?(message = "") ~loc () = ~start_colnum:[%e A.eint ~loc (loc.loc_start.pos_cnum - loc.loc_start.pos_bol)] ~end_lnum:[%e A.eint ~loc loc.loc_end.pos_lnum] ~end_colnum:[%e A.eint ~loc (loc.loc_end.pos_cnum - loc.loc_end.pos_bol)] - ~message:[%e A.estring ~loc message] ~entry_id:__entry_id] + ~message:[%e A.estring ~loc message] ~entry_id:__entry_id + ~log_level:[%e A.eint ~loc log_level]] -let open_log_no_source ~message ~loc () = - [%expr Debug_runtime.open_log_no_source ~message:[%e message] ~entry_id:__entry_id] +let open_log_no_source ~message ~loc ~log_level () = + [%expr + Debug_runtime.open_log_no_source ~message:[%e message] ~entry_id:__entry_id + ~log_level:[%e A.eint ~loc log_level]] let close_log ~loc = [%expr @@ -214,32 +179,16 @@ let to_descr context ~loc ~descr_loc typ = {|ppx_minidebug: multiline log descriptions not allowed, found: "%s"|} descr else [%expr Some [%e A.estring ~loc:descr_loc.loc descr]] -let check_prefix prefixes exp = - let rec loop = function - | { pexp_desc = Pexp_tuple (exp :: _); _ } - | [%expr [%e? exp] :: [%e? _]] - | { pexp_desc = Pexp_array (exp :: _); _ } -> - loop exp - | { pexp_desc = Pexp_constant (Pconst_string (s, _, _)); _ } -> - Array.exists (fun prefix -> String.starts_with ~prefix s) prefixes - | _ -> false - in - loop exp - -let check_log_level context ~is_explicit ~is_result exp thunk = +let check_comptime_log_level context ~is_explicit ~is_result:_ ~log_level exp thunk = let loc = exp.pexp_loc in - match context.log_level with - | Nothing -> [%expr ()] - | Prefixed [||] -> if is_explicit then thunk () else [%expr ()] - | Prefixed_or_result [||] -> if is_explicit || is_result then thunk () else [%expr ()] - | Prefixed prefixes when not (check_prefix prefixes exp) -> [%expr ()] - | Prefixed_or_result prefixes when not (is_result || check_prefix prefixes exp) -> - [%expr ()] - | _ -> thunk () + (* TODO: consider also allowing non-explicit result logs when restrict_to_explicit. *) + if context.restrict_to_explicit && not is_explicit then [%expr ()] + else if context.comptime_log_level < log_level then [%expr ()] + else thunk () (* *** The sexplib-based variant. *** *) -let log_value_sexp context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = - check_log_level context ~is_explicit ~is_result exp @@ fun () -> +let log_value_sexp context ~loc ~typ ?descr_loc ~is_explicit ~is_result ~log_level exp = + check_comptime_log_level context ~is_explicit ~is_result ~log_level exp @@ fun () -> match typ with | { ptyp_desc = Ptyp_poly (_, { ptyp_desc = Ptyp_extension ext; _ }); @@ -250,12 +199,14 @@ let log_value_sexp context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = (* Propagate error if the type could not be found. *) A.pexp_extension ~loc ext | { ptyp_desc = Ptyp_poly (_, typ); _ } | typ -> - (* [%sexp_of: typ] does not work with `Ptyp_poly`. Misleading error "Let with no bindings". *) + (* [%sexp_of: typ] does not work with `Ptyp_poly`. Misleading error "Let with no + bindings". *) incr global_log_count; [%expr Debug_runtime.log_value_sexp ?descr:[%e to_descr context ~loc ~descr_loc typ] - ~entry_id:__entry_id ~is_result:[%e A.ebool ~loc is_result] + ~entry_id:__entry_id ~log_level:[%e A.eint ~loc log_level] + ~is_result:[%e A.ebool ~loc is_result] ([%sexp_of: [%t typ]] [%e exp])] (* *** The deriving.show pp-based variant. *** *) @@ -268,8 +219,8 @@ let rec splice_lident ~id_prefix ident = | Ldot (path, id) -> Ldot (path, splice id) | Lapply (f, a) -> Lapply (splice_lident ~id_prefix f, a) -let log_value_pp context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = - check_log_level context ~is_explicit ~is_result exp @@ fun () -> +let log_value_pp context ~loc ~typ ?descr_loc ~is_explicit ~is_result ~log_level exp = + check_comptime_log_level context ~is_explicit ~is_result ~log_level exp @@ fun () -> match typ with | { ptyp_desc = @@ -285,8 +236,8 @@ let log_value_pp context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = [%expr Debug_runtime.log_value_pp ?descr:[%e to_descr context ~loc ~descr_loc typ] - ~entry_id:__entry_id ~pp:[%e converter] ~is_result:[%e A.ebool ~loc is_result] - [%e exp]] + ~entry_id:__entry_id ~log_level:[%e A.eint ~loc log_level] ~pp:[%e converter] + ~is_result:[%e A.ebool ~loc is_result] [%e exp]] | _ -> A.pexp_extension ~loc @@ Location.error_extensionf ~loc @@ -294,8 +245,8 @@ let log_value_pp context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = or _sexp" (* *** The deriving.show string-based variant. *** *) -let log_value_show context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = - check_log_level context ~is_explicit ~is_result exp @@ fun () -> +let log_value_show context ~loc ~typ ?descr_loc ~is_explicit ~is_result ~log_level exp = + check_comptime_log_level context ~is_explicit ~is_result ~log_level exp @@ fun () -> match typ with | { ptyp_desc = Ptyp_poly (_, { ptyp_desc = Ptyp_extension ext; _ }); @@ -311,7 +262,8 @@ let log_value_show context ~loc ~typ ?descr_loc ~is_explicit ~is_result exp = [%expr Debug_runtime.log_value_show ?descr:[%e to_descr context ~loc ~descr_loc typ] - ~entry_id:__entry_id ~is_result:[%e A.ebool ~loc is_result] + ~entry_id:__entry_id ~log_level:[%e A.eint ~loc log_level] + ~is_result:[%e A.ebool ~loc is_result] ([%show: [%t typ]] [%e exp])] let log_value context = @@ -321,12 +273,15 @@ let log_value context = | Pp -> log_value_pp context (* *** The sexplib-based variant. *** *) -let log_value_printbox context ~loc exp = - check_log_level context ~is_explicit:true ~is_result:false exp @@ fun () -> +let log_value_printbox context ~loc ~log_level exp = + check_comptime_log_level context ~is_explicit:true ~is_result:false ~log_level exp + @@ fun () -> incr global_log_count; - [%expr Debug_runtime.log_value_printbox ~entry_id:__entry_id [%e exp]] + [%expr + Debug_runtime.log_value_printbox ~entry_id:__entry_id + ~log_level:[%e A.eint ~loc log_level] [%e exp]] -let log_string ~loc ~descr_loc s = +let log_string ~loc ~descr_loc ~log_level s = if String.contains descr_loc.txt '\n' then A.pexp_extension ~loc @@ Location.error_extensionf ~loc @@ -335,12 +290,13 @@ let log_string ~loc ~descr_loc s = [%expr Debug_runtime.log_value_show ~descr:[%e A.estring ~loc:descr_loc.loc descr_loc.txt] - ~entry_id:__entry_id ~is_result:false [%e A.estring ~loc s]] + ~entry_id:__entry_id ~log_level:[%e A.eint ~loc log_level] ~is_result:false + [%e A.estring ~loc s]] -let log_string_with_descr ~loc ~message s = +let log_string_with_descr ~loc ~message ~log_level s = [%expr - Debug_runtime.log_value_show ~descr:[%e message] ~entry_id:__entry_id ~is_result:false - [%e A.estring ~loc s]] + Debug_runtime.log_value_show ~descr:[%e message] ~entry_id:__entry_id + ~log_level:[%e A.eint ~loc log_level] ~is_result:false [%e A.estring ~loc s]] type fun_arg = | Pexp_fun_arg of @@ -537,7 +493,7 @@ let entry_with_interrupts context ~loc ?descr_loc ?message ~log_count_before ?he | _ -> assert false in if - context.log_level <> Everything + context.comptime_log_level <= 2 && log_count_before = !global_log_count && message = None then entry @@ -548,12 +504,13 @@ let entry_with_interrupts context ~loc ?descr_loc ?message ~log_count_before ?he let __entry_id = Debug_runtime.get_entry_id () in [%e header]; if Debug_runtime.exceeds_max_children () then ( - [%e log_string ""]; + [%e log_string ~log_level:context.entry_log_level ""]; failwith "ppx_minidebug: max_num_children exceeded") else ( [%e preamble]; if Debug_runtime.exceeds_max_nesting () then ( - [%e log_string ""]; + [%e + log_string ~log_level:context.entry_log_level ""]; [%e close_log ~loc]; failwith "ppx_minidebug: max_nesting_depth exceeded") else @@ -586,7 +543,7 @@ let debug_body context callback ~loc ~message ~descr_loc ~log_count_before ~arg_ | Some t when context.output_type_info -> message ^ " : " ^ typ2str t | _ -> message in - let preamble = open_log ~message ~loc () in + let preamble = open_log ~message ~loc ~log_level:context.entry_log_level () in let preamble = List.fold_left (fun e1 e2 -> @@ -609,7 +566,7 @@ let debug_body context callback ~loc ~message ~descr_loc ~log_count_before ~arg_ | Some typ -> ( body, log_value context ~loc ~typ ~descr_loc ~is_explicit:false ~is_result:true - (pat2expr result) ) + ~log_level:context.entry_log_level (pat2expr result) ) in entry_with_interrupts context ~loc ~descr_loc ~log_count_before ~preamble ~entry:(callback context body) ~result ~log_result () @@ -673,7 +630,7 @@ let debug_fun context callback ?typ ?ret_descr ?ret_typ exp = in pass_runtime context.toplevel_opt_arg @@ expand_fun body args in - if context.log_level = Nothing then no_change_exp () + if context.comptime_log_level <= 0 then no_change_exp () else let arg_typs, ret_typ3 = match typ with @@ -714,7 +671,7 @@ let debug_fun context callback ?typ ?ret_descr ?ret_typ exp = List.map (fun (descr_loc, pat, typ) -> log_value context ~loc:pexp_loc ~typ ~descr_loc ~is_explicit:false - ~is_result:false (pat2expr pat)) + ~is_result:false ~log_level:context.entry_log_level (pat2expr pat)) bound @ arg_log (arg_typs, args) | ( [], @@ -725,7 +682,7 @@ let debug_fun context callback ?typ ?ret_descr ?ret_typ exp = List.map (fun (descr_loc, pat, typ) -> log_value context ~loc:pexp_loc ~typ ~descr_loc ~is_explicit:false - ~is_result:false (pat2expr pat)) + ~is_result:false ~log_level:context.entry_log_level (pat2expr pat)) bound @ arg_log ([], args) | _, [] -> [] @@ -751,7 +708,7 @@ let debug_case ?(unpack_context = Nested) context callback ?ret_descr ?ret_typ ? List.map (fun (descr_loc, pat, typ) -> log_value context ~loc ~typ ~descr_loc ~is_explicit:false ~is_result:false - (pat2expr pat)) + ~log_level:context.entry_log_level (pat2expr pat)) bound in let message = pat2descr ~default:"_" pc_lhs in @@ -813,7 +770,7 @@ let debug_binding context callback vb = (* [%pat? ([%p pat] : (module Minidebug_runtime.PrintBox_runtime) -> [%t typ])] *) | _ -> vb.pvb_pat in - if context.log_level = Nothing then + if context.comptime_log_level <= 0 then { vb with pvb_pat; @@ -854,7 +811,7 @@ let debug_binding context callback vb = | { pexp_desc = Pexp_function cases; _ } -> debug_function context callback ~loc:vb.pvb_expr.pexp_loc ?ret_descr ?ret_typ ?arg_typ cases - | _ when context.toplevel_opt_arg = Nested && no_results context.log_level -> + | _ when context.toplevel_opt_arg = Nested && context.comptime_log_level <= 1 -> callback nested exp | _ -> let result, bound = bound_patterns ~alt_typ:typ pat in @@ -866,7 +823,8 @@ let debug_binding context callback vb = List.map (fun (descr_loc, pat, typ) -> log_value context ~loc:vb.pvb_expr.pexp_loc ~typ ~descr_loc - ~is_explicit:false ~is_result:true (pat2expr pat)) + ~is_explicit:false ~is_result:true ~log_level:context.entry_log_level + (pat2expr pat)) bound |> List.fold_left (fun e1 e2 -> @@ -875,7 +833,10 @@ let debug_binding context callback vb = [%e e2]]) [%expr ()] in - let preamble = open_log ~message:descr_loc.txt ~loc:descr_loc.loc () in + let preamble = + open_log ~message:descr_loc.txt ~loc:descr_loc.loc + ~log_level:context.entry_log_level () + in entry_with_interrupts context ~loc ~descr_loc ~log_count_before ~preamble ~entry:(callback nested exp) ~result ~log_result () in @@ -1008,6 +969,7 @@ type rule = { expander : [ `Debug | `Debug_this | `Str ]; restrict_to_explicit : bool; log_value : log_value; + entry_log_level : int option; } let rules = @@ -1016,59 +978,86 @@ let rules = (fun track_or_explicit -> List.concat @@ List.map - (fun toplevel_opt_arg -> + (fun log_level -> List.concat @@ List.map - (fun expander -> - List.map - (fun log_value -> - let ext_point = - match track_or_explicit with - | `Debug -> "debug" - | `Track -> "track" - | `Diagn -> "diagn" - in - let ext_point = - ext_point - ^ - match expander with - | `Debug_this -> "_this" - | `Debug | `Str -> "" - in - let ext_point = - match toplevel_opt_arg with - | Nested -> assert false - | Toplevel_no_arg -> ext_point - | Generic -> ext_point ^ "_rt" - | PrintBox -> ext_point ^ "_rtb" - | Generic_local -> ext_point ^ "_l" - | PrintBox_local -> ext_point ^ "_lb" - in - let ext_point = - ext_point ^ "_" - ^ - match log_value with - | Pp -> "pp" - | Sexp -> "sexp" - | Show -> "show" - in - { - ext_point; - track_branches = track_or_explicit = `Track; - toplevel_opt_arg; - expander; - restrict_to_explicit = track_or_explicit = `Diagn; - log_value; - }) - [ Pp; Sexp; Show ]) - [ `Debug; `Debug_this; `Str ]) - [ Toplevel_no_arg; Generic; PrintBox; Generic_local; PrintBox_local ]) + (fun toplevel_opt_arg -> + List.concat + @@ List.map + (fun expander -> + List.map + (fun log_value -> + let ext_point = + match track_or_explicit with + | `Debug -> "debug" + | `Track -> "track" + | `Diagn -> "diagn" + in + let ext_point = + ext_point + ^ + if log_level = 0 then "" else string_of_int log_level + in + let ext_point = + ext_point + ^ + match expander with + | `Debug_this -> "_this" + | `Debug | `Str -> "" + in + let ext_point = + match toplevel_opt_arg with + | Nested -> assert false + | Toplevel_no_arg -> ext_point + | Generic -> ext_point ^ "_rt" + | PrintBox -> ext_point ^ "_rtb" + | Generic_local -> ext_point ^ "_l" + | PrintBox_local -> ext_point ^ "_lb" + in + let ext_point = + ext_point ^ "_" + ^ + match log_value with + | Pp -> "pp" + | Sexp -> "sexp" + | Show -> "show" + in + { + ext_point; + track_branches = track_or_explicit = `Track; + toplevel_opt_arg; + expander; + restrict_to_explicit = track_or_explicit = `Diagn; + log_value; + entry_log_level = + (if log_level = 0 then None else Some log_level); + }) + [ Pp; Sexp; Show ]) + [ `Debug; `Debug_this; `Str ]) + [ Toplevel_no_arg; Generic; PrintBox; Generic_local; PrintBox_local ]) + [ 0; 1; 2; 3; 4; 5; 6; 7; 8; 9 ]) [ `Track; `Debug; `Diagn ] -let is_ext_point = - let points = List.map (fun r -> Re.str r.ext_point) rules in - let regex = Re.(compile @@ seq [ start; alt points; stop ]) in - Re.execp regex +let entry_rules = + Hashtbl.of_seq @@ List.to_seq + @@ List.map (fun ({ ext_point; _ } as r) -> (ext_point, r)) rules + +let with_opt_digit ~prefix ~suffix txt = + String.starts_with ~prefix txt + && String.ends_with ~suffix txt + && + let plen = String.length prefix in + let slen = String.length suffix in + match String.sub txt plen (String.length txt - plen - slen) with + | "" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" -> true + | _ -> false + +let get_opt_digit ~prefix ~suffix txt = + let plen = String.length prefix in + let slen = String.length suffix in + match String.sub txt plen (String.length txt - plen - slen) with + | "" -> None + | s -> Some (int_of_string s) let traverse_expression = object (self) @@ -1076,9 +1065,6 @@ let traverse_expression = method! expression context orig_exp = let callback context e = self#expression context e in - let restrict_to_explicit = - match context.log_level with Nothing | Prefixed _ -> true | _ -> false - in let track_cases ?ret_descr ?ret_typ ?arg_typ kind = List.mapi (debug_case context callback ?ret_descr ?ret_typ ?arg_typ kind) in @@ -1092,7 +1078,7 @@ let traverse_expression = let exp = match exp.pexp_desc with | Pexp_let (rec_flag, bindings, body) - when context.toplevel_opt_arg <> Nested || not restrict_to_explicit -> + when context.toplevel_opt_arg <> Nested || not context.restrict_to_explicit -> let bindings = List.map (debug_binding context callback) bindings in { exp with @@ -1102,39 +1088,23 @@ let traverse_expression = bindings, callback { context with toplevel_opt_arg = Nested } body ); } - | Pexp_extension ({ loc = _; txt }, PStr [%str [%e? body]]) when is_ext_point txt - -> - let prefix_pos = String.index txt '_' in - let track_branches, log_level = - match (String.sub txt 0 prefix_pos, context.log_level) with - | "debug", _ -> (false, context.log_level) - | "track", _ -> (true, context.log_level) - | "diagn", Nothing -> (false, Nothing) - | "diagn", Prefixed prefixes | "diagn", Prefixed_or_result prefixes -> - (false, Prefixed prefixes) - | "diagn", _ -> (false, Prefixed [||]) - | _ -> (context.track_branches, context.log_level) - in - let suffix_pos = String.rindex txt '_' in - let log_value = - match String.sub txt suffix_pos (String.length txt - suffix_pos) with - | "_pp" -> Pp - | "_show" -> Show - | "_sexp" -> Sexp - | _ -> context.log_value - in + | Pexp_extension ({ loc = _; txt }, PStr [%str [%e? body]]) + when Hashtbl.mem entry_rules txt -> + let r = Hashtbl.find entry_rules txt in (* NOTE: it's a current bug to ignore _this_ here, but _this_ will go away. *) - let toplevel_opt_arg = - if String.length txt > 9 && String.sub txt 5 4 = "_rt_" then Generic - else if String.length txt > 10 && String.sub txt 5 5 = "_rtb_" then PrintBox - else if String.length txt > 8 && String.sub txt 5 3 = "_l_" then - Generic_local - else if String.length txt > 9 && String.sub txt 5 4 = "_lb_" then - PrintBox_local - else Toplevel_no_arg + let entry_log_level = + match r.entry_log_level with + | None -> context.entry_log_level + | Some ll -> ll in self#expression - { context with log_value; track_branches; toplevel_opt_arg; log_level } + { + context with + log_value = r.log_value; + track_branches = r.track_branches; + toplevel_opt_arg = r.toplevel_opt_arg; + entry_log_level; + } body | Pexp_extension ({ loc = _; txt = "debug_notrace" }, PStr [%str [%e? body]]) -> callback { context with track_branches = false } body @@ -1146,7 +1116,8 @@ let traverse_expression = [%e? body]] ) -> ( match parse_log_level level with | Right error -> error - | Left log_level -> callback { context with log_level } body) + | Left comptime_log_level -> callback { context with comptime_log_level } body + ) | Pexp_extension ( { loc = _; txt = "debug_interrupts" }, PStr @@ -1167,26 +1138,49 @@ let traverse_expression = {max_nesting_depth=N;max_num_children=M}; ]" | Pexp_extension ({ loc = _; txt = "debug_type_info" }, PStr [%str [%e? body]]) -> callback { context with output_type_info = true } body - | Pexp_extension ({ loc = _; txt = "log" }, PStr [%str [%e? body]]) -> + | Pexp_extension ({ loc = _; txt }, PStr [%str [%e? body]]) + when with_opt_digit ~prefix:"log" ~suffix:"" txt -> let typ = extract_type ~alt_typ:ret_typ body in - log_value context ~loc ~typ ~is_explicit:true ~is_result:false body - | Pexp_extension ({ loc = _; txt = "log_result" }, PStr [%str [%e? body]]) -> + let log_level = + Option.value ~default:context.entry_log_level + @@ get_opt_digit ~prefix:"log" ~suffix:"" txt + in + log_value context ~loc ~typ ~is_explicit:true ~is_result:false ~log_level body + | Pexp_extension ({ loc = _; txt }, PStr [%str [%e? body]]) + when with_opt_digit ~prefix:"log" ~suffix:"_result" txt -> let typ = extract_type ~alt_typ:ret_typ body in - log_value context ~loc ~typ ~is_explicit:true ~is_result:true body - | Pexp_extension ({ loc = _; txt = "log_printbox" }, PStr [%str [%e? body]]) -> - log_value_printbox context ~loc body + let log_level = + Option.value ~default:context.entry_log_level + @@ get_opt_digit ~prefix:"log" ~suffix:"_result" txt + in + log_value context ~loc ~typ ~is_explicit:true ~is_result:true ~log_level body + | Pexp_extension ({ loc = _; txt }, PStr [%str [%e? body]]) + when with_opt_digit ~prefix:"log" ~suffix:"_printbox" txt -> + let log_level = + Option.value ~default:context.entry_log_level + @@ get_opt_digit ~prefix:"log" ~suffix:"_printbox" txt + in + log_value_printbox context ~loc ~log_level body | Pexp_extension - ( { loc = _; txt = "log_entry" }, + ( { loc = _; txt }, PStr [%str [%e? message]; - [%e? entry]] ) -> - if context.log_level = Nothing then + [%e? entry]] ) + when with_opt_digit ~prefix:"log" ~suffix:"_entry" txt -> + if context.comptime_log_level <= 0 then callback { context with toplevel_opt_arg = Nested } entry else + let entry_log_level = + Option.value ~default:context.entry_log_level + @@ get_opt_digit ~prefix:"log" ~suffix:"_entry" txt + in let log_count_before = !global_log_count in - let preamble = open_log_no_source ~message ~loc () in + let preamble = + open_log_no_source ~message ~loc ~log_level:context.entry_log_level () + in let result = A.ppat_var ~loc { loc; txt = "__res" } in + let context = { context with entry_log_level } in let entry = callback { context with toplevel_opt_arg = Nested } entry in let log_result = [%expr ()] in entry_with_interrupts context ~loc ~message ~log_count_before ~preamble @@ -1197,10 +1191,10 @@ let traverse_expression = "ppx_minidebug: bad syntax, expacted [%%log_entry
; \ ]" | (Pexp_newtype _ | Pexp_fun _) - when context.toplevel_opt_arg <> Nested || not restrict_to_explicit -> + when context.toplevel_opt_arg <> Nested || not context.restrict_to_explicit -> debug_fun context callback ?typ:ret_typ exp | Pexp_match ([%expr ([%e? expr] : [%t? arg_typ])], cases) - when context.track_branches && context.log_level <> Nothing -> + when context.track_branches && context.comptime_log_level > 0 -> { exp with pexp_desc = @@ -1208,14 +1202,14 @@ let traverse_expression = (callback context expr, track_cases ~arg_typ ?ret_typ "match" cases); } | Pexp_match (expr, cases) - when context.track_branches && context.log_level <> Nothing -> + when context.track_branches && context.comptime_log_level > 0 -> { exp with pexp_desc = Pexp_match (callback context expr, track_cases ?ret_typ "match" cases); } - | Pexp_function cases when context.track_branches && context.log_level <> Nothing - -> + | Pexp_function cases + when context.track_branches && context.comptime_log_level > 0 -> let arg_typ, ret_typ = match ret_typ with | Some { ptyp_desc = Ptyp_arrow (_, arg, ret); _ } -> (Some arg, Some ret) @@ -1224,7 +1218,7 @@ let traverse_expression = debug_function context callback ~loc:exp.pexp_loc ?arg_typ ?ret_typ cases | Pexp_function cases when is_local_debug_runtime context.toplevel_opt_arg - && context.log_level <> Nothing -> + && context.comptime_log_level > 0 -> let arg_typ, ret_typ = match ret_typ with | Some { ptyp_desc = Ptyp_arrow (_, arg, ret); _ } -> (Some arg, Some ret) @@ -1232,7 +1226,7 @@ let traverse_expression = in debug_function context callback ~loc:exp.pexp_loc ?arg_typ ?ret_typ cases | Pexp_ifthenelse (if_, then_, else_) - when context.track_branches && context.log_level <> Nothing -> + when context.track_branches && context.comptime_log_level > 0 -> let then_ = let log_count_before = !global_log_count in let loc = then_.pexp_loc in @@ -1241,7 +1235,7 @@ let traverse_expression = let then_' = [%expr let __entry_id = Debug_runtime.get_entry_id () in - [%e open_log ~message ~loc ()]; + [%e open_log ~message ~loc ~log_level:context.entry_log_level ()]; match [%e then_] with | if_then__result -> [%e close_log ~loc]; @@ -1250,8 +1244,8 @@ let traverse_expression = [%e close_log ~loc]; raise e] in - if context.log_level <> Everything && log_count_before = !global_log_count - then then_ + if context.restrict_to_explicit && log_count_before = !global_log_count then + then_ else then_' in let else_ = @@ -1264,7 +1258,7 @@ let traverse_expression = let message = "else:" ^ loc_to_name loc in [%expr let __entry_id = Debug_runtime.get_entry_id () in - [%e open_log ~message ~loc ()]; + [%e open_log ~message ~loc ~log_level:context.entry_log_level ()]; match [%e else_] with | if_else__result -> [%e close_log ~loc]; @@ -1274,13 +1268,13 @@ let traverse_expression = raise e]) else_ in - if context.log_level <> Everything && log_count_before = !global_log_count - then else_ + if context.restrict_to_explicit && log_count_before = !global_log_count then + else_ else else_' in { exp with pexp_desc = Pexp_ifthenelse (callback context if_, then_, else_) } | Pexp_for (pat, from, to_, dir, body) - when context.track_branches && context.log_level <> Nothing -> + when context.track_branches && context.comptime_log_level > 0 -> let log_count_before = !global_log_count in let body = let loc = body.pexp_loc in @@ -1291,11 +1285,13 @@ let traverse_expression = [] in let preamble = - open_log ~message:("") ~loc:descr_loc.loc () + open_log + ~message:("") + ~loc:descr_loc.loc ~log_level:context.entry_log_level () in let header = log_value context ~loc ~typ ~descr_loc ~is_explicit:false ~is_result:false - (pat2expr pat) + ~log_level:context.entry_log_level (pat2expr pat) in entry_with_interrupts context ~loc ~descr_loc ~log_count_before ~header ~preamble ~entry:(callback context body) @@ -1308,24 +1304,27 @@ let traverse_expression = let transformed = [%expr let __entry_id = Debug_runtime.get_entry_id () in - [%e open_log ~message ~loc ()]; + [%e open_log ~message ~loc ~log_level:context.entry_log_level ()]; match [%e { exp with pexp_desc }] with | () -> [%e close_log ~loc] | exception e -> [%e close_log ~loc]; raise e] in - if context.log_level <> Everything && log_count_before = !global_log_count - then { exp with pexp_desc } + if context.restrict_to_explicit && log_count_before = !global_log_count then + { exp with pexp_desc } else transformed | Pexp_while (cond, body) - when context.track_branches && context.log_level <> Nothing -> + when context.track_branches && context.comptime_log_level > 0 -> let log_count_before = !global_log_count in let message = "while:" ^ loc_to_name loc in let body = let loc = body.pexp_loc in let descr_loc = { txt = ""; loc } in - let preamble = open_log ~message:"" ~loc:descr_loc.loc () in + let preamble = + open_log ~message:"" ~loc:descr_loc.loc + ~log_level:context.entry_log_level () + in entry_with_interrupts context ~loc ~descr_loc ~log_count_before ~preamble ~entry:(callback context body) ~result:[%pat? ()] @@ -1336,15 +1335,15 @@ let traverse_expression = let transformed = [%expr let __entry_id = Debug_runtime.get_entry_id () in - [%e open_log ~message ~loc ()]; + [%e open_log ~message ~loc ~log_level:context.entry_log_level ()]; match [%e { exp with pexp_desc }] with | () -> [%e close_log ~loc] | exception e -> [%e close_log ~loc]; raise e] in - if context.log_level <> Everything && log_count_before = !global_log_count - then { exp with pexp_desc } + if context.restrict_to_explicit && log_count_before = !global_log_count then + { exp with pexp_desc } else transformed | _ -> super#expression { context with toplevel_opt_arg = Nested } exp in @@ -1492,8 +1491,8 @@ let global_log_level = function | [ { pstr_desc = Pstr_eval (exp, attrs); _ } ] -> ( match parse_log_level exp with - | Left log_level -> - init_context := { !init_context with log_level }; + | Left comptime_log_level -> + init_context := { !init_context with comptime_log_level }; A.pstr_eval ~loc [%expr ()] attrs | Right error -> A.pstr_eval ~loc error attrs) | _ -> @@ -1501,24 +1500,11 @@ let global_log_level = (A.pexp_extension ~loc @@ Location.error_extensionf ~loc "ppx_minidebug: bad syntax, expacted [%%%%global_debug_log_level \ - Level]") + ]") []) in Ppxlib.Context_free.Rule.extension declaration -let string_to_log_level s = - let s = String.lowercase_ascii s in - ( s, - match s with - | "nothing" -> Some Nothing - | "prefixed_error" -> Some (Prefixed [| "ERROR" |]) - | "prefixed_warn_error" -> Some (Prefixed [| "WARN"; "ERROR" |]) - | "prefixed_info_warn_error" -> Some (Prefixed [| "INFO"; "WARN"; "ERROR" |]) - | "explicit_logs" -> Some (Prefixed [||]) - | "nonempty_entries" -> Some Nonempty_entries - | "everything" -> Some Everything - | _ -> None ) - let global_log_level_from_env_var ~check_consistency = let declaration = Extension.V3.declare @@ -1539,8 +1525,8 @@ let global_log_level_from_env_var ~check_consistency = }; ] -> ( let noop = A.pstr_eval ~loc [%expr ()] attrs in - let update log_level_string log_level = - init_context := { !init_context with log_level }; + let update log_level_string comptime_log_level = + init_context := { !init_context with comptime_log_level }; if check_consistency then let lifted_log_level = Ast_helper.Exp.constant ~loc @@ -1556,8 +1542,9 @@ let global_log_level_from_env_var ~check_consistency = Ast_helper.Exp.constant ~loc:s_loc @@ Ast_helper.Const.string ~loc:s_loc env_n] in - (* TODO(#53): instead of equality, for verbosity log levels, check that - the compile time level is greater-or-equal to the runtime level. *) + (* TODO(#53): instead of equality, for verbosity log levels, check + that the compile time level is greater-or-equal to the runtime + level. *) if (not (Stdlib.String.equal "" runtime_log_level)) && not @@ -1571,20 +1558,21 @@ let global_log_level_from_env_var ~check_consistency = attrs else noop in - match string_to_log_level @@ Sys.getenv env_n with - | s, Some log_level -> update s log_level - | "", None -> noop - | s, None -> - A.pstr_eval ~loc - (A.pexp_extension ~loc - @@ Location.error_extensionf ~loc - "environment variable %s setting should be empty or one of: \ - nothing, prefixed_error, prefixed_warn_error, \ - prefixed_info_warn_error, explicit_logs, nonempty_entries, \ - everything; found: %s" - env_n s) - attrs - | exception Not_found -> noop) + try + let log_level_string = Sys.getenv env_n in + if log_level_string = "" then noop + else + match int_of_string_opt log_level_string with + | Some log_level -> update log_level_string log_level + | None -> + A.pstr_eval ~loc + (A.pexp_extension ~loc + @@ Location.error_extensionf ~loc + "environment variable %s should be empty or an integer; \ + found: %s" + env_n log_level_string) + attrs + with Not_found -> noop) | _ -> A.pstr_eval ~loc (A.pexp_extension ~loc @@ -1615,6 +1603,7 @@ let rules = expander; restrict_to_explicit; log_value; + entry_log_level; } -> let declaration = match expander with @@ -1622,54 +1611,39 @@ let rules = Extension.V3.declare ext_point Extension.Context.expression Ast_pattern.(single_expr_payload __) (fun ~ctxt:_ -> - let log_level = - match (restrict_to_explicit, !init_context.log_level) with - | _, Nothing -> Nothing - | true, Prefixed prefixes | true, Prefixed_or_result prefixes -> - Prefixed prefixes - | true, _ -> Prefixed [||] - | false, level -> level - in debug_expander { !init_context with toplevel_opt_arg; track_branches; - log_level; + restrict_to_explicit; + entry_log_level = Option.value entry_log_level ~default:1; log_value; }) | `Debug_this -> Extension.V3.declare ext_point Extension.Context.expression Ast_pattern.(single_expr_payload __) (fun ~ctxt:_ -> - let log_level = - if restrict_to_explicit && !init_context.log_level <> Nothing then - Prefixed [||] - else !init_context.log_level - in debug_this_expander { !init_context with toplevel_opt_arg; track_branches; - log_level; + restrict_to_explicit; + entry_log_level = Option.value entry_log_level ~default:1; log_value; }) | `Str -> Extension.V3.declare ext_point Extension.Context.structure_item Ast_pattern.(pstr __) (fun ~ctxt -> - let log_level = - if restrict_to_explicit && !init_context.log_level <> Nothing then - Prefixed [||] - else !init_context.log_level - in str_expander { !init_context with toplevel_opt_arg; track_branches; - log_level; + restrict_to_explicit; + entry_log_level = Option.value entry_log_level ~default:1; log_value; } ~loc:(Expansion_context.Extension.extension_point_loc ctxt)) diff --git a/test-debug-residual.log b/test-debug-residual.log new file mode 100644 index 0000000..d5cf4e7 --- /dev/null +++ b/test-debug-residual.log @@ -0,0 +1,1403 @@ +File "test/test_expect_test.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_expect_test.ml b/_build/.sandbox/c14fb2d188c4295d4f58e8c1936c4c06/default/test/test_expect_test.ml.corrected +index 8c90266..c42bab5 100644 +--- a/_build/default/test/test_expect_test.ml ++++ b/_build/.sandbox/c14fb2d188c4295d4f58e8c1936c4c06/default/test/test_expect_test.ml.corrected +@@ -328,25 +328,25 @@ let%expect_test "%debug_this_show depth exceeded" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":317:40: loop_exceeded ++ "test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 7 +- ├─"test/test_expect_test.ml":320:10: z ++ ├─"test/test_expect_test.ml":321:10: z + │ └─z = 3 +- └─"test/test_expect_test.ml":317:40: loop_exceeded ++ └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 6 +- ├─"test/test_expect_test.ml":320:10: z ++ ├─"test/test_expect_test.ml":321:10: z + │ └─z = 2 +- └─"test/test_expect_test.ml":317:40: loop_exceeded ++ └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 5 +- ├─"test/test_expect_test.ml":320:10: z ++ ├─"test/test_expect_test.ml":321:10: z + │ └─z = 2 +- └─"test/test_expect_test.ml":317:40: loop_exceeded ++ └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 4 +- ├─"test/test_expect_test.ml":320:10: z ++ ├─"test/test_expect_test.ml":321:10: z + │ └─z = 1 +- └─"test/test_expect_test.ml":317:40: loop_exceeded ++ └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 3 +- └─"test/test_expect_test.ml":320:10: z ++ └─"test/test_expect_test.ml":321:10: z + └─z = + Raised exception. + |}] +@@ -369,28 +369,28 @@ let%expect_test "%debug_this_show num children exceeded linear" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":356:26: _bar +- ├─"test/test_expect_test.ml":360:16: _baz ++ "test/test_expect_test.ml":358:26: _bar ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 0 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 2 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 4 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 6 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 8 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 10 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 12 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 14 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 16 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 18 +- ├─"test/test_expect_test.ml":360:16: _baz ++ ├─"test/test_expect_test.ml":362:16: _baz + │ └─_baz = 20 + └─_baz = + Raised exception: ppx_minidebug: max_num_children exceeded +@@ -412,25 +412,25 @@ let%expect_test "%debug_this_show truncated children linear" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":400:26: _bar ++ "test/test_expect_test.ml":403:26: _bar + ├─ +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 44 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 46 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 48 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 50 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 52 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 54 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 56 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 58 +- ├─"test/test_expect_test.ml":402:14: _baz ++ ├─"test/test_expect_test.ml":405:14: _baz + │ └─_baz = 60 + └─_bar = () + |}] +@@ -453,27 +453,27 @@ let%expect_test "%track_this_show track for-loop num children exceeded" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":438:26: _bar +- └─"test/test_expect_test.ml":441:10: for:test_expect_test:441 ++ "test/test_expect_test.ml":442:26: _bar ++ └─"test/test_expect_test.ml":445:10: for:test_expect_test:445 + ├─i = 0 +- ├─"test/test_expect_test.ml":441:14: +- │ └─"test/test_expect_test.ml":442:16: _baz ++ ├─"test/test_expect_test.ml":445:14: ++ │ └─"test/test_expect_test.ml":446:16: _baz + │ └─_baz = 0 + ├─i = 1 +- ├─"test/test_expect_test.ml":441:14: +- │ └─"test/test_expect_test.ml":442:16: _baz ++ ├─"test/test_expect_test.ml":445:14: ++ │ └─"test/test_expect_test.ml":446:16: _baz + │ └─_baz = 2 + ├─i = 2 +- ├─"test/test_expect_test.ml":441:14: +- │ └─"test/test_expect_test.ml":442:16: _baz ++ ├─"test/test_expect_test.ml":445:14: ++ │ └─"test/test_expect_test.ml":446:16: _baz + │ └─_baz = 4 + ├─i = 3 +- ├─"test/test_expect_test.ml":441:14: +- │ └─"test/test_expect_test.ml":442:16: _baz ++ ├─"test/test_expect_test.ml":445:14: ++ │ └─"test/test_expect_test.ml":446:16: _baz + │ └─_baz = 6 + ├─i = 4 +- ├─"test/test_expect_test.ml":441:14: +- │ └─"test/test_expect_test.ml":442:16: _baz ++ ├─"test/test_expect_test.ml":445:14: ++ │ └─"test/test_expect_test.ml":446:16: _baz + │ └─_baz = 8 + ├─i = 5 + └─i = +@@ -496,28 +496,28 @@ let%expect_test "%track_this_show track for-loop truncated children" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":482:26: _bar +- ├─"test/test_expect_test.ml":483:8: for:test_expect_test:483 ++ "test/test_expect_test.ml":487:26: _bar ++ ├─"test/test_expect_test.ml":488:8: for:test_expect_test:488 + │ ├─ + │ ├─i = 26 +- │ ├─"test/test_expect_test.ml":483:12: +- │ │ └─"test/test_expect_test.ml":484:14: _baz ++ │ ├─"test/test_expect_test.ml":488:12: ++ │ │ └─"test/test_expect_test.ml":489:14: _baz + │ │ └─_baz = 52 + │ ├─i = 27 +- │ ├─"test/test_expect_test.ml":483:12: +- │ │ └─"test/test_expect_test.ml":484:14: _baz ++ │ ├─"test/test_expect_test.ml":488:12: ++ │ │ └─"test/test_expect_test.ml":489:14: _baz + │ │ └─_baz = 54 + │ ├─i = 28 +- │ ├─"test/test_expect_test.ml":483:12: +- │ │ └─"test/test_expect_test.ml":484:14: _baz ++ │ ├─"test/test_expect_test.ml":488:12: ++ │ │ └─"test/test_expect_test.ml":489:14: _baz + │ │ └─_baz = 56 + │ ├─i = 29 +- │ ├─"test/test_expect_test.ml":483:12: +- │ │ └─"test/test_expect_test.ml":484:14: _baz ++ │ ├─"test/test_expect_test.ml":488:12: ++ │ │ └─"test/test_expect_test.ml":489:14: _baz + │ │ └─_baz = 58 + │ ├─i = 30 +- │ └─"test/test_expect_test.ml":483:12: +- │ └─"test/test_expect_test.ml":484:14: _baz ++ │ └─"test/test_expect_test.ml":488:12: ++ │ └─"test/test_expect_test.ml":489:14: _baz + │ └─_baz = 60 + └─_bar = () + |}] +@@ -540,35 +540,35 @@ let%expect_test "%track_this_show track for-loop" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":523:26: _bar +- ├─"test/test_expect_test.ml":526:10: for:test_expect_test:526 ++ "test/test_expect_test.ml":529:26: _bar ++ ├─"test/test_expect_test.ml":532:10: for:test_expect_test:532 + │ ├─i = 0 +- │ ├─"test/test_expect_test.ml":526:14: +- │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ ├─"test/test_expect_test.ml":532:14: ++ │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 0 + │ ├─i = 1 +- │ ├─"test/test_expect_test.ml":526:14: +- │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ ├─"test/test_expect_test.ml":532:14: ++ │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 2 + │ ├─i = 2 +- │ ├─"test/test_expect_test.ml":526:14: +- │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ ├─"test/test_expect_test.ml":532:14: ++ │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 4 + │ ├─i = 3 +- │ ├─"test/test_expect_test.ml":526:14: +- │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ ├─"test/test_expect_test.ml":532:14: ++ │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 6 + │ ├─i = 4 +- │ ├─"test/test_expect_test.ml":526:14: +- │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ ├─"test/test_expect_test.ml":532:14: ++ │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 8 + │ ├─i = 5 +- │ ├─"test/test_expect_test.ml":526:14: +- │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ ├─"test/test_expect_test.ml":532:14: ++ │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 10 + │ ├─i = 6 +- │ └─"test/test_expect_test.ml":526:14: +- │ └─"test/test_expect_test.ml":527:16: _baz ++ │ └─"test/test_expect_test.ml":532:14: ++ │ └─"test/test_expect_test.ml":533:16: _baz + │ └─_baz = 12 + └─_bar = () + |}] +@@ -597,35 +597,35 @@ let%expect_test "%track_this_show track for-loop, time spans" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":574:26: _bar +- ├─"test/test_expect_test.ml":577:10: for:test_expect_test:577 ++ "test/test_expect_test.ml":581:26: _bar ++ ├─"test/test_expect_test.ml":584:10: for:test_expect_test:584 + │ ├─i = 0 +- │ ├─"test/test_expect_test.ml":577:14: +- │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ ├─"test/test_expect_test.ml":584:14: ++ │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 0 + │ ├─i = 1 +- │ ├─"test/test_expect_test.ml":577:14: +- │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ ├─"test/test_expect_test.ml":584:14: ++ │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 2 + │ ├─i = 2 +- │ ├─"test/test_expect_test.ml":577:14: +- │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ ├─"test/test_expect_test.ml":584:14: ++ │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 4 + │ ├─i = 3 +- │ ├─"test/test_expect_test.ml":577:14: +- │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ ├─"test/test_expect_test.ml":584:14: ++ │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 6 + │ ├─i = 4 +- │ ├─"test/test_expect_test.ml":577:14: +- │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ ├─"test/test_expect_test.ml":584:14: ++ │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 8 + │ ├─i = 5 +- │ ├─"test/test_expect_test.ml":577:14: +- │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ ├─"test/test_expect_test.ml":584:14: ++ │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 10 + │ ├─i = 6 +- │ └─"test/test_expect_test.ml":577:14: +- │ └─"test/test_expect_test.ml":578:16: _baz ++ │ └─"test/test_expect_test.ml":584:14: ++ │ └─"test/test_expect_test.ml":585:16: _baz + │ └─_baz = 12 + └─_bar = () + |}] +@@ -647,25 +647,25 @@ let%expect_test "%track_this_show track while-loop" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":629:26: _bar +- ├─"test/test_expect_test.ml":631:8: while:test_expect_test:631 +- │ ├─"test/test_expect_test.ml":632:10: +- │ │ └─"test/test_expect_test.ml":632:14: _baz ++ "test/test_expect_test.ml":637:26: _bar ++ ├─"test/test_expect_test.ml":639:8: while:test_expect_test:639 ++ │ ├─"test/test_expect_test.ml":640:10: ++ │ │ └─"test/test_expect_test.ml":640:14: _baz + │ │ └─_baz = 0 +- │ ├─"test/test_expect_test.ml":632:10: +- │ │ └─"test/test_expect_test.ml":632:14: _baz ++ │ ├─"test/test_expect_test.ml":640:10: ++ │ │ └─"test/test_expect_test.ml":640:14: _baz + │ │ └─_baz = 2 +- │ ├─"test/test_expect_test.ml":632:10: +- │ │ └─"test/test_expect_test.ml":632:14: _baz ++ │ ├─"test/test_expect_test.ml":640:10: ++ │ │ └─"test/test_expect_test.ml":640:14: _baz + │ │ └─_baz = 4 +- │ ├─"test/test_expect_test.ml":632:10: +- │ │ └─"test/test_expect_test.ml":632:14: _baz ++ │ ├─"test/test_expect_test.ml":640:10: ++ │ │ └─"test/test_expect_test.ml":640:14: _baz + │ │ └─_baz = 6 +- │ ├─"test/test_expect_test.ml":632:10: +- │ │ └─"test/test_expect_test.ml":632:14: _baz ++ │ ├─"test/test_expect_test.ml":640:10: ++ │ │ └─"test/test_expect_test.ml":640:14: _baz + │ │ └─_baz = 8 +- │ └─"test/test_expect_test.ml":632:10: +- │ └─"test/test_expect_test.ml":632:14: _baz ++ │ └─"test/test_expect_test.ml":640:10: ++ │ └─"test/test_expect_test.ml":640:14: _baz + │ └─_baz = 10 + └─_bar = () + |}] +@@ -689,39 +689,39 @@ let%expect_test "%debug_this_show num children exceeded nested" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":667:40: loop_exceeded ++ "test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 3 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 1 +- └─"test/test_expect_test.ml":667:40: loop_exceeded ++ └─"test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 2 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 0 +- └─"test/test_expect_test.ml":667:40: loop_exceeded ++ └─"test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 1 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 0 +- └─"test/test_expect_test.ml":667:40: loop_exceeded ++ └─"test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 0 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 0 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 1 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 2 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 3 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 4 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 5 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 6 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 7 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 8 +- ├─"test/test_expect_test.ml":674:17: z ++ ├─"test/test_expect_test.ml":682:17: z + │ └─z = 9 + └─z = + Raised exception: ppx_minidebug: max_num_children exceeded +@@ -744,108 +744,108 @@ let%expect_test "%debug_this_show truncated children nested" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":723:40: loop_exceeded ++ "test/test_expect_test.ml":732:40: loop_exceeded + ├─ +- ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ ├─ +- │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 +- │ ├─"test/test_expect_test.ml":728:15: z ++ │ ├─"test/test_expect_test.ml":737:15: z + │ │ └─z = 5 +- │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 + │ └─loop_exceeded = 11685 +- ├─"test/test_expect_test.ml":728:15: z ++ ├─"test/test_expect_test.ml":737:15: z + │ └─z = 5 +- ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ ├─ +- │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 +- │ ├─"test/test_expect_test.ml":728:15: z ++ │ ├─"test/test_expect_test.ml":737:15: z + │ │ └─z = 5 +- │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 +@@ -869,52 +869,52 @@ let%expect_test "%track_this_show highlight FIXME" = + {| + BEGIN DEBUG SESSION + ┌─────────────────────────────────────────────────┐ +- │"test/test_expect_test.ml":851:41: loop_highlight│ ++ │"test/test_expect_test.ml":861:41: loop_highlight│ + ├─────────────────────────────────────────────────┘ + ├─x = 7 + ├─┬────────────────────────────────────┐ +- │ │"test/test_expect_test.ml":854:10: z│ ++ │ │"test/test_expect_test.ml":864:10: z│ + │ ├────────────────────────────────────┘ + │ └─┬─────┐ + │ │z = 3│ + │ └─────┘ + ├─┬─────────────────────────────────────────────────┐ +- │ │"test/test_expect_test.ml":851:41: loop_highlight│ ++ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ ├─────────────────────────────────────────────────┘ + │ ├─x = 6 +- │ ├─"test/test_expect_test.ml":854:10: z ++ │ ├─"test/test_expect_test.ml":864:10: z + │ │ └─z = 2 + │ ├─┬─────────────────────────────────────────────────┐ +- │ │ │"test/test_expect_test.ml":851:41: loop_highlight│ ++ │ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ │ ├─────────────────────────────────────────────────┘ + │ │ ├─x = 5 +- │ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ └─z = 2 + │ │ ├─┬─────────────────────────────────────────────────┐ +- │ │ │ │"test/test_expect_test.ml":851:41: loop_highlight│ ++ │ │ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ │ │ ├─────────────────────────────────────────────────┘ + │ │ │ ├─x = 4 +- │ │ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ └─z = 1 + │ │ │ ├─┬─────────────────────────────────────────────────┐ +- │ │ │ │ │"test/test_expect_test.ml":851:41: loop_highlight│ ++ │ │ │ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ │ │ │ ├─────────────────────────────────────────────────┘ + │ │ │ │ ├─┬─────┐ + │ │ │ │ │ │x = 3│ + │ │ │ │ │ └─────┘ +- │ │ │ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ └─z = 1 +- │ │ │ │ ├─"test/test_expect_test.ml":851:41: loop_highlight ++ │ │ │ │ ├─"test/test_expect_test.ml":861:41: loop_highlight + │ │ │ │ │ ├─x = 2 +- │ │ │ │ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ │ └─z = 0 +- │ │ │ │ │ ├─"test/test_expect_test.ml":851:41: loop_highlight ++ │ │ │ │ │ ├─"test/test_expect_test.ml":861:41: loop_highlight + │ │ │ │ │ │ ├─x = 1 +- │ │ │ │ │ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ │ │ └─z = 0 +- │ │ │ │ │ │ ├─"test/test_expect_test.ml":851:41: loop_highlight ++ │ │ │ │ │ │ ├─"test/test_expect_test.ml":861:41: loop_highlight + │ │ │ │ │ │ │ ├─x = 0 +- │ │ │ │ │ │ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ │ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ │ │ │ └─z = 0 + │ │ │ │ │ │ │ └─loop_highlight = 0 + │ │ │ │ │ │ └─loop_highlight = 0 +@@ -942,16 +942,16 @@ let%expect_test "%track_this_show PrintBox tracking" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":921:37: track_branches ++ "test/test_expect_test.ml":932:37: track_branches + ├─x = 7 +- ├─"test/test_expect_test.ml":923:9: else:test_expect_test:923 +- │ └─"test/test_expect_test.ml":923:36: ++ ├─"test/test_expect_test.ml":934:9: else:test_expect_test:934 ++ │ └─"test/test_expect_test.ml":934:36: + └─track_branches = 4 + 4 +- "test/test_expect_test.ml":921:37: track_branches ++ "test/test_expect_test.ml":932:37: track_branches + ├─x = 3 +- ├─"test/test_expect_test.ml":922:18: then:test_expect_test:922 +- │ └─"test/test_expect_test.ml":922:54: ++ ├─"test/test_expect_test.ml":933:18: then:test_expect_test:933 ++ │ └─"test/test_expect_test.ml":933:54: + └─track_branches = -3 + -3 + |}] +@@ -975,9 +975,9 @@ let%expect_test "%track_this_show PrintBox tracking " = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":954:11: ++ "test/test_expect_test.ml":965:11: + 4 +- "test/test_expect_test.ml":956:11: x ++ "test/test_expect_test.ml":967:11: x + -3 + |}] + +@@ -1008,19 +1008,19 @@ let%expect_test "%track_this_show PrintBox tracking with debug_notrace" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":975:37: track_branches ++ "test/test_expect_test.ml":986:37: track_branches + ├─x = 8 +- ├─"test/test_expect_test.ml":984:6: else:test_expect_test:984 +- │ └─"test/test_expect_test.ml":988:10: +- │ └─"test/test_expect_test.ml":988:14: result +- │ ├─"test/test_expect_test.ml":988:44: then:test_expect_test:988 ++ ├─"test/test_expect_test.ml":995:6: else:test_expect_test:995 ++ │ └─"test/test_expect_test.ml":999:10: ++ │ └─"test/test_expect_test.ml":999:14: result ++ │ ├─"test/test_expect_test.ml":999:44: then:test_expect_test:999 + │ └─result = 8 + └─track_branches = 8 + 8 +- "test/test_expect_test.ml":975:37: track_branches ++ "test/test_expect_test.ml":986:37: track_branches + ├─x = 3 +- ├─"test/test_expect_test.ml":977:6: then:test_expect_test:977 +- │ └─"test/test_expect_test.ml":981:14: result ++ ├─"test/test_expect_test.ml":988:6: then:test_expect_test:988 ++ │ └─"test/test_expect_test.ml":992:14: result + │ └─result = 3 + └─track_branches = 3 + 3 +@@ -1042,9 +1042,9 @@ let%expect_test "%track_show PrintBox not tracking anonymous functions with debu + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":1021:27: track_foo ++ "test/test_expect_test.ml":1032:27: track_foo + ├─x = 8 +- ├─"test/test_expect_test.ml":1024:4: fun:test_expect_test:1024 ++ ├─"test/test_expect_test.ml":1035:4: fun:test_expect_test:1035 + │ └─z = 8 + └─track_foo = 8 + 8 +@@ -1077,18 +1077,18 @@ let%expect_test "respect scope of nested extension points" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":1043:37: track_branches ++ "test/test_expect_test.ml":1055:37: track_branches + ├─x = 8 +- ├─"test/test_expect_test.ml":1052:6: else:test_expect_test:1052 +- │ └─"test/test_expect_test.ml":1056:25: result +- │ ├─"test/test_expect_test.ml":1056:55: then:test_expect_test:1056 ++ ├─"test/test_expect_test.ml":1064:6: else:test_expect_test:1064 ++ │ └─"test/test_expect_test.ml":1068:25: result ++ │ ├─"test/test_expect_test.ml":1068:55: then:test_expect_test:1068 + │ └─result = 8 + └─track_branches = 8 + 8 +- "test/test_expect_test.ml":1043:37: track_branches ++ "test/test_expect_test.ml":1055:37: track_branches + ├─x = 3 +- ├─"test/test_expect_test.ml":1045:6: then:test_expect_test:1045 +- │ └─"test/test_expect_test.ml":1049:25: result ++ ├─"test/test_expect_test.ml":1057:6: then:test_expect_test:1057 ++ │ └─"test/test_expect_test.ml":1061:25: result + │ └─result = 3 + └─track_branches = 3 + 3 +@@ -1113,7 +1113,7 @@ let%expect_test "%debug_show un-annotated toplevel fun" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":1087:27: anonymous ++ "test/test_expect_test.ml":1099:27: anonymous + └─"We do log this function" + 6 + 6 +@@ -1141,8 +1141,8 @@ let%expect_test "%debug_show nested un-annotated toplevel fun" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":1112:25: wrapper +- "test/test_expect_test.ml":1113:29: anonymous ++ "test/test_expect_test.ml":1124:25: wrapper ++ "test/test_expect_test.ml":1125:29: anonymous + └─"We do log this function" + 6 + 6 +@@ -1160,7 +1160,7 @@ let%expect_test "%track_this_show no return type anonymous fun" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":1141:32: anonymous ++ "test/test_expect_test.ml":1153:32: anonymous + └─x = 3 + 6 + |}]; +@@ -1173,15 +1173,15 @@ let%expect_test "%track_this_show no return type anonymous fun" = + in + [%expect + {| +- "test/test_expect_test.ml":1155:32: anonymous ++ "test/test_expect_test.ml":1167:32: anonymous + ├─x = 3 +- ├─"test/test_expect_test.ml":1156:50: fun:test_expect_test:1156 ++ ├─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + │ └─i = 0 +- ├─"test/test_expect_test.ml":1156:50: fun:test_expect_test:1156 ++ ├─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + │ └─i = 1 +- ├─"test/test_expect_test.ml":1156:50: fun:test_expect_test:1156 ++ ├─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + │ └─i = 2 +- └─"test/test_expect_test.ml":1156:50: fun:test_expect_test:1156 ++ └─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + └─i = 3 + 6 + |}] +@@ -1205,80 +1205,80 @@ let%expect_test "%track_this_show anonymous fun, num children exceeded" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":1179:40: loop_exceeded ++ "test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 3 +- └─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ └─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + ├─i = 0 +- ├─"test/test_expect_test.ml":1186:17: z ++ ├─"test/test_expect_test.ml":1198:17: z + │ └─z = 1 +- └─"test/test_expect_test.ml":1187:35: else:test_expect_test:1187 +- └─"test/test_expect_test.ml":1179:40: loop_exceeded ++ └─"test/test_expect_test.ml":1199:35: else:test_expect_test:1199 ++ └─"test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 2 +- └─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ └─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + ├─i = 0 +- ├─"test/test_expect_test.ml":1186:17: z ++ ├─"test/test_expect_test.ml":1198:17: z + │ └─z = 0 +- └─"test/test_expect_test.ml":1187:35: else:test_expect_test:1187 +- └─"test/test_expect_test.ml":1179:40: loop_exceeded ++ └─"test/test_expect_test.ml":1199:35: else:test_expect_test:1199 ++ └─"test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 1 +- └─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ └─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + ├─i = 0 +- ├─"test/test_expect_test.ml":1186:17: z ++ ├─"test/test_expect_test.ml":1198:17: z + │ └─z = 0 +- └─"test/test_expect_test.ml":1187:35: else:test_expect_test:1187 +- └─"test/test_expect_test.ml":1179:40: loop_exceeded ++ └─"test/test_expect_test.ml":1199:35: else:test_expect_test:1199 ++ └─"test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 0 +- ├─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 0 +- │ ├─"test/test_expect_test.ml":1186:17: z ++ │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 0 +- │ └─"test/test_expect_test.ml":1187:28: then:test_expect_test:1187 +- ├─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 ++ ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 1 +- │ ├─"test/test_expect_test.ml":1186:17: z ++ │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 1 +- │ └─"test/test_expect_test.ml":1187:28: then:test_expect_test:1187 +- ├─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 ++ ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 2 +- │ ├─"test/test_expect_test.ml":1186:17: z ++ │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 2 +- │ └─"test/test_expect_test.ml":1187:28: then:test_expect_test:1187 +- ├─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 ++ ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 3 +- │ ├─"test/test_expect_test.ml":1186:17: z ++ │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 3 +- │ └─"test/test_expect_test.ml":1187:28: then:test_expect_test:1187 +- ├─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 ++ │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 ++ ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 4 +- │ ├─"test/test_expect_test.ml":1186:17: z ++ │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 4 +- │ └─"test/test_expect_test.ml":1187:28: then:test_expect_test:1187 +- ├─"test/test_expect_test.ml":1185:11: fun:test_expect_test:1185 +...TRUNCATED BY DUNE... ++
{#4} _foobar = ()
  • "test/test_expect_test.ml":3209:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
+ +
{#2} [3; 1; 2; 3]
  • {orphaned from #2}
+ +@@ -3252,7 +3255,7 @@ let%expect_test "%diagn_show ignores type annots" = + 336 + 109 + toplevel +- ├─"test/test_expect_test.ml":3151:17 ++ ├─"test/test_expect_test.ml":3233:17 + ├─("for bar, b-3", 42) + └─("for baz, f squared", 64) + |}] +@@ -3278,11 +3281,11 @@ let%expect_test "%diagn_show ignores non-empty bindings" = + {| + BEGIN DEBUG SESSION + bar +- ├─"test/test_expect_test.ml":3180:21 ++ ├─"test/test_expect_test.ml":3262:21 + └─("for bar, b-3", 42) + 336 + baz +- ├─"test/test_expect_test.ml":3187:21 ++ ├─"test/test_expect_test.ml":3269:21 + └─("foo baz, f squared", 49) + 91 + |}] +@@ -3303,10 +3306,10 @@ let%expect_test "%diagn_show no logs FIXME" = + [%expect {| + BEGIN DEBUG SESSION + bar +- └─"test/test_expect_test.ml":3210:21 ++ └─"test/test_expect_test.ml":3292:21 + 336 + baz +- └─"test/test_expect_test.ml":3216:21 ++ └─"test/test_expect_test.ml":3298:21 + 91 + |}] + +@@ -3335,25 +3338,25 @@ let%expect_test "%debug_show log level TODO" = + 336 + 109 + () +- ├─"test/test_expect_test.ml":3228:17 ++ ├─"test/test_expect_test.ml":3315:17 + ├─bar = 336 +- │ ├─"test/test_expect_test.ml":3231:14 ++ │ ├─"test/test_expect_test.ml":3318:14 + │ ├─first = 7 + │ ├─second = 42 + │ ├─{first=a; second=b} +- │ │ ├─"test/test_expect_test.ml":3232:12 ++ │ │ ├─"test/test_expect_test.ml":3319:12 + │ │ └─ + │ │ ├─a = 7 + │ │ └─b = 45 + │ ├─y = 8 +- │ │ └─"test/test_expect_test.ml":3233:12 ++ │ │ └─"test/test_expect_test.ml":3320:12 + │ └─("for bar, b-3", 42) + └─baz = 109 +- ├─"test/test_expect_test.ml":3237:14 ++ ├─"test/test_expect_test.ml":3324:14 + ├─first = 7 + ├─second = 42 + ├─{first; second} +- │ ├─"test/test_expect_test.ml":3238:12 ++ │ ├─"test/test_expect_test.ml":3325:12 + │ └─ + │ ├─first = 8 + │ └─second = 45 +@@ -3387,25 +3390,25 @@ let%expect_test "%debug_show log level TODO compile+runtime" = + 336 + 109 + () +- ├─"test/test_expect_test.ml":3276:17 ++ ├─"test/test_expect_test.ml":3367:17 + ├─bar = 336 +- │ ├─"test/test_expect_test.ml":3279:14 ++ │ ├─"test/test_expect_test.ml":3370:14 + │ ├─first = 7 + │ ├─second = 42 + │ ├─{first=a; second=b} +- │ │ ├─"test/test_expect_test.ml":3280:12 ++ │ │ ├─"test/test_expect_test.ml":3371:12 + │ │ └─ + │ │ ├─a = 7 + │ │ └─b = 45 + │ ├─y = 8 +- │ │ └─"test/test_expect_test.ml":3281:12 ++ │ │ └─"test/test_expect_test.ml":3372:12 + │ └─("for bar, b-3", 42) + └─baz = 109 +- ├─"test/test_expect_test.ml":3285:14 ++ ├─"test/test_expect_test.ml":3376:14 + ├─first = 7 + ├─second = 42 + ├─{first; second} +- │ ├─"test/test_expect_test.ml":3286:12 ++ │ ├─"test/test_expect_test.ml":3377:12 + │ └─ + │ ├─first = 8 + │ └─second = 45 +@@ -3424,75 +3427,75 @@ let%expect_test "%debug_this_show PrintBox snapshot" = + {| + BEGIN DEBUG SESSION + loop_highlight +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 7 + └─z = 3 +- └─"test/test_expect_test.ml":3311:8 ++ └─"test/test_expect_test.ml":3418:8 + +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 7 + ├─z = 3 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 6 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 5 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 4 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 3 + └─z = 1 +- └─"test/test_expect_test.ml":3311:8 ++ └─"test/test_expect_test.ml":3418:8 + +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 7 + ├─z = 3 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 6 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 6 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 4 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 5 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 2 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 4 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 1 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 3 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 2 + ├─z = 0 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 1 + ├─z = 0 +- │ └─"test/test_expect_test.ml":3311:8 ++ │ └─"test/test_expect_test.ml":3418:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3310:41 ++ ├─"test/test_expect_test.ml":3417:41 + ├─x = 0 + └─z = 0 +- └─"test/test_expect_test.ml":3311:8 ++ └─"test/test_expect_test.ml":3418:8 + 9 + |}] + +@@ -3534,7 +3537,7 @@ let%expect_test "%log_printbox" = + {| + BEGIN DEBUG SESSION + foo = () +- ├─"test/test_expect_test.ml":3410:21 ++ ├─"test/test_expect_test.ml":3517:21 + ├─0/0│0/1│0/2│0/3│0/4 + │ ───┼───┼───┼───┼─── + │ 1/0│1/1│1/2│1/3│1/4 +@@ -3599,7 +3602,7 @@ let%expect_test "%log_printbox flushing" = + [%expect + {| + BEGIN DEBUG SESSION +- foo begin "test/test_expect_test.ml":3472:21: ++ foo begin "test/test_expect_test.ml":3579:21: + 0/0│0/1│0/2│0/3│0/4 + ───┼───┼───┼───┼─── + 1/0│1/1│1/2│1/3│1/4 +@@ -3624,7 +3627,7 @@ let%expect_test "%log_printbox flushing" = + + + 4/0 4/1 4/2 4/3 4/4 +- bar begin "test/test_expect_test.ml":3481:12: ++ bar begin "test/test_expect_test.ml":3588:12: + "Now with a frame:" + ┌───┬───┬───┬───┬───┐ + │0/0│0/1│0/2│0/3│0/4│ +@@ -3684,7 +3687,7 @@ let%expect_test "%log_entry" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":3541:17: _logging_logic ++ "test/test_expect_test.ml":3648:17: _logging_logic + ├─"preamble" + ├─header 1 + │ ├─"log 1" +@@ -3724,36 +3727,36 @@ let%expect_test "flame graph" = + print_endline output; + [%expect + {| +-
++
+-
++
+-
++
+-
++
+-
++
+- +
+-
++
+-
++
+- +
+-
++
+-
++
+-
++
+-
++
+- +
+-
++
+-
++
+-
++
+- +@@ -3828,31 +3831,31 @@ let%expect_test "flame graph reduced ToC" = + print_endline output; + [%expect + {| +-
++
+-
++
+-
++
+-
++
+-
++ +
+-
++
+- +
+-
++
+-
++
+-
++
+-
++ +
+-
++
+-
++
+- +@@ -3910,10 +3913,10 @@ let%expect_test "%debug_show skip module bindings" = + {| + BEGIN DEBUG SESSION + bar = 15 +- ├─"test/test_expect_test.ml":3791:21 ++ ├─"test/test_expect_test.ml":3898:21 + ├─x = 7 + └─y = 8 +- └─"test/test_expect_test.ml":3793:8 ++ └─"test/test_expect_test.ml":3900:8 + 15 + |}] + +@@ -3939,52 +3942,52 @@ let%expect_test "%track_l_show procedure runtime passing" = + [%expect + {| + BEGIN DEBUG SESSION foo-1 +- foo-1 foo begin "test/test_expect_test.ml":3818:28: ++ foo-1 foo begin "test/test_expect_test.ml":3925:28: + "inside foo" + foo-1 foo end + + BEGIN DEBUG SESSION foo-1 +- foo-1 () begin "test/test_expect_test.ml":3824:8: ++ foo-1 () begin "test/test_expect_test.ml":3931:8: + "inside bar" + foo-1 () end + + BEGIN DEBUG SESSION foo-2 +- foo-2 foo begin "test/test_expect_test.ml":3818:28: ++ foo-2 foo begin "test/test_expect_test.ml":3925:28: + "inside foo" + foo-2 foo end + + BEGIN DEBUG SESSION foo-2 +- foo-2 () begin "test/test_expect_test.ml":3824:8: ++ foo-2 () begin "test/test_expect_test.ml":3931:8: + "inside bar" + foo-2 () end + + BEGIN DEBUG SESSION foo-3 +- foo-3 foo begin "test/test_expect_test.ml":3818:28: ++ foo-3 foo begin "test/test_expect_test.ml":3925:28: + "inside foo" + foo-3 foo end + + BEGIN DEBUG SESSION foo-3 +- foo-3 () begin "test/test_expect_test.ml":3824:8: ++ foo-3 () begin "test/test_expect_test.ml":3931:8: + "inside bar" + foo-3 () end + + BEGIN DEBUG SESSION foo-4 +- foo-4 foo begin "test/test_expect_test.ml":3818:28: ++ foo-4 foo begin "test/test_expect_test.ml":3925:28: + "inside foo" + foo-4 foo end + + BEGIN DEBUG SESSION foo-4 +- foo-4 () begin "test/test_expect_test.ml":3824:8: ++ foo-4 () begin "test/test_expect_test.ml":3931:8: + "inside bar" + foo-4 () end + + BEGIN DEBUG SESSION foo-5 +- foo-5 foo begin "test/test_expect_test.ml":3818:28: ++ foo-5 foo begin "test/test_expect_test.ml":3925:28: + "inside foo" + foo-5 foo end + + BEGIN DEBUG SESSION foo-5 +- foo-5 () begin "test/test_expect_test.ml":3824:8: ++ foo-5 () begin "test/test_expect_test.ml":3931:8: + "inside bar" + foo-5 () end + |}] +@@ -4044,18 +4047,18 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + ┌─────────┐ + │bar = 336│ + ├─────────┘ +- ├─"test/test_expect_test.ml":3921:21 ++ ├─"test/test_expect_test.ml":4028:21 + ├─first = 7 + ├─second = 42 + └─┬─────┐ + │y = 8│ + ├─────┘ +- └─"test/test_expect_test.ml":3922:8 ++ └─"test/test_expect_test.ml":4029:8 + 336 + ┌────────┐ + │(r1, r2)│ + ├────────┘ +- ├─"test/test_expect_test.ml":3931:6 ++ ├─"test/test_expect_test.ml":4038:6 + ├─┬─────────┐ + │ ││ + │ ├─────────┘ +@@ -4066,13 +4069,13 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + └─┬────────────────┐ + │baz = (339, 109)│ + ├────────────────┘ +- ├─"test/test_expect_test.ml":3926:10 ++ ├─"test/test_expect_test.ml":4033:10 + ├─first = 7 + ├─second = 42 + ├─┬──────┐ + │ │(y, z)│ + │ ├──────┘ +- │ ├─"test/test_expect_test.ml":3927:8 ++ │ ├─"test/test_expect_test.ml":4034:8 + │ └─┬────────┐ + │ ││ + │ ├────────┘ +@@ -4083,7 +4086,7 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + └─┬──────┐ + │(a, b)│ + ├──────┘ +- ├─"test/test_expect_test.ml":3928:8 ++ ├─"test/test_expect_test.ml":4035:8 + └─┬────────┐ + ││ + ├────────┘ diff --git a/test-debug-residual2.log b/test-debug-residual2.log new file mode 100644 index 0000000..62d0598 --- /dev/null +++ b/test-debug-residual2.log @@ -0,0 +1,593 @@ +File "test/test_expect_test.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_expect_test.ml b/_build/.sandbox/128f98dcbba2b9a32a643385d1cbaf63/default/test/test_expect_test.ml.corrected +index c42bab5..caff578 100644 +--- a/_build/default/test/test_expect_test.ml ++++ b/_build/.sandbox/128f98dcbba2b9a32a643385d1cbaf63/default/test/test_expect_test.ml.corrected +@@ -3106,7 +3106,7 @@ let%expect_test "%log without scope values_first_mode" = + {| + BEGIN DEBUG SESSION + _bar = () +- └─"test/test_expect_test.ml":3094:17 {#1} ++ └─"test/test_expect_test.ml":3095:17 {#1} + ("This is like", 3, "or", 3.14, "above") + └─{orphaned from #1} + ("tau =", 6.28) +@@ -3154,13 +3154,13 @@ let%expect_test "%log with print_entry_ids, mixed up scopes" = + {| + BEGIN DEBUG SESSION + bar = () +- └─"test/test_expect_test.ml":3130:21 {#1} ++ └─"test/test_expect_test.ml":3132:21 {#1} + baz = () +- └─"test/test_expect_test.ml":3137:21 {#2} ++ └─"test/test_expect_test.ml":3139:21 {#2} + bar = () +- └─"test/test_expect_test.ml":3130:21 {#3} ++ └─"test/test_expect_test.ml":3132:21 {#3} + _foobar = () +- ├─"test/test_expect_test.ml":3149:17 {#4} ++ ├─"test/test_expect_test.ml":3151:17 {#4} + ├─("This is like", 3, "or", 3.14, "above") + ├─("tau =", 6.28) + ├─[3; 1; 2; 3] +@@ -3214,13 +3214,13 @@ let%expect_test "%log with print_entry_ids, verbose_entry_ids in HTML, values_fi + [%expect + {| + BEGIN DEBUG SESSION +-
{#1} bar = ()
  • "test/test_expect_test.ml":3190:21
++
{#1} bar = ()
  • "test/test_expect_test.ml":3193:21
+ +-
{#2} baz = ()
  • "test/test_expect_test.ml":3197:21
++
{#2} baz = ()
  • "test/test_expect_test.ml":3200:21
+ +-
{#3} bar = ()
  • "test/test_expect_test.ml":3190:21
++
{#3} bar = ()
  • "test/test_expect_test.ml":3193:21
+ +-
{#4} _foobar = ()
  • "test/test_expect_test.ml":3209:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
++
{#4} _foobar = ()
  • "test/test_expect_test.ml":3212:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
+ +
{#2} [3; 1; 2; 3]
  • {orphaned from #2}
+ +@@ -3255,7 +3255,7 @@ let%expect_test "%diagn_show ignores type annots" = + 336 + 109 + toplevel +- ├─"test/test_expect_test.ml":3233:17 ++ ├─"test/test_expect_test.ml":3236:17 + ├─("for bar, b-3", 42) + └─("for baz, f squared", 64) + |}] +@@ -3281,11 +3281,11 @@ let%expect_test "%diagn_show ignores non-empty bindings" = + {| + BEGIN DEBUG SESSION + bar +- ├─"test/test_expect_test.ml":3262:21 ++ ├─"test/test_expect_test.ml":3265:21 + └─("for bar, b-3", 42) + 336 + baz +- ├─"test/test_expect_test.ml":3269:21 ++ ├─"test/test_expect_test.ml":3272:21 + └─("foo baz, f squared", 49) + 91 + |}] +@@ -3306,10 +3306,10 @@ let%expect_test "%diagn_show no logs FIXME" = + [%expect {| + BEGIN DEBUG SESSION + bar +- └─"test/test_expect_test.ml":3292:21 ++ └─"test/test_expect_test.ml":3295:21 + 336 + baz +- └─"test/test_expect_test.ml":3298:21 ++ └─"test/test_expect_test.ml":3301:21 + 91 + |}] + +@@ -3338,25 +3338,25 @@ let%expect_test "%debug_show log level TODO" = + 336 + 109 + () +- ├─"test/test_expect_test.ml":3315:17 ++ ├─"test/test_expect_test.ml":3318:17 + ├─bar = 336 +- │ ├─"test/test_expect_test.ml":3318:14 ++ │ ├─"test/test_expect_test.ml":3321:14 + │ ├─first = 7 + │ ├─second = 42 + │ ├─{first=a; second=b} +- │ │ ├─"test/test_expect_test.ml":3319:12 ++ │ │ ├─"test/test_expect_test.ml":3322:12 + │ │ └─ + │ │ ├─a = 7 + │ │ └─b = 45 + │ ├─y = 8 +- │ │ └─"test/test_expect_test.ml":3320:12 ++ │ │ └─"test/test_expect_test.ml":3323:12 + │ └─("for bar, b-3", 42) + └─baz = 109 +- ├─"test/test_expect_test.ml":3324:14 ++ ├─"test/test_expect_test.ml":3327:14 + ├─first = 7 + ├─second = 42 + ├─{first; second} +- │ ├─"test/test_expect_test.ml":3325:12 ++ │ ├─"test/test_expect_test.ml":3328:12 + │ └─ + │ ├─first = 8 + │ └─second = 45 +@@ -3390,25 +3390,25 @@ let%expect_test "%debug_show log level TODO compile+runtime" = + 336 + 109 + () +- ├─"test/test_expect_test.ml":3367:17 ++ ├─"test/test_expect_test.ml":3370:17 + ├─bar = 336 +- │ ├─"test/test_expect_test.ml":3370:14 ++ │ ├─"test/test_expect_test.ml":3373:14 + │ ├─first = 7 + │ ├─second = 42 + │ ├─{first=a; second=b} +- │ │ ├─"test/test_expect_test.ml":3371:12 ++ │ │ ├─"test/test_expect_test.ml":3374:12 + │ │ └─ + │ │ ├─a = 7 + │ │ └─b = 45 + │ ├─y = 8 +- │ │ └─"test/test_expect_test.ml":3372:12 ++ │ │ └─"test/test_expect_test.ml":3375:12 + │ └─("for bar, b-3", 42) + └─baz = 109 +- ├─"test/test_expect_test.ml":3376:14 ++ ├─"test/test_expect_test.ml":3379:14 + ├─first = 7 + ├─second = 42 + ├─{first; second} +- │ ├─"test/test_expect_test.ml":3377:12 ++ │ ├─"test/test_expect_test.ml":3380:12 + │ └─ + │ ├─first = 8 + │ └─second = 45 +@@ -3427,75 +3427,75 @@ let%expect_test "%debug_this_show PrintBox snapshot" = + {| + BEGIN DEBUG SESSION + loop_highlight +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 7 + └─z = 3 +- └─"test/test_expect_test.ml":3418:8 ++ └─"test/test_expect_test.ml":3421:8 + +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 7 + ├─z = 3 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 6 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 5 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 4 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 3 + └─z = 1 +- └─"test/test_expect_test.ml":3418:8 ++ └─"test/test_expect_test.ml":3421:8 + +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 7 + ├─z = 3 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 6 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 6 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 4 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 5 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 2 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 4 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 1 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 3 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 2 + ├─z = 0 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 1 + ├─z = 0 +- │ └─"test/test_expect_test.ml":3418:8 ++ │ └─"test/test_expect_test.ml":3421:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3417:41 ++ ├─"test/test_expect_test.ml":3420:41 + ├─x = 0 + └─z = 0 +- └─"test/test_expect_test.ml":3418:8 ++ └─"test/test_expect_test.ml":3421:8 + 9 + |}] + +@@ -3537,7 +3537,7 @@ let%expect_test "%log_printbox" = + {| + BEGIN DEBUG SESSION + foo = () +- ├─"test/test_expect_test.ml":3517:21 ++ ├─"test/test_expect_test.ml":3520:21 + ├─0/0│0/1│0/2│0/3│0/4 + │ ───┼───┼───┼───┼─── + │ 1/0│1/1│1/2│1/3│1/4 +@@ -3602,7 +3602,7 @@ let%expect_test "%log_printbox flushing" = + [%expect + {| + BEGIN DEBUG SESSION +- foo begin "test/test_expect_test.ml":3579:21: ++ foo begin "test/test_expect_test.ml":3582:21: + 0/0│0/1│0/2│0/3│0/4 + ───┼───┼───┼───┼─── + 1/0│1/1│1/2│1/3│1/4 +@@ -3627,7 +3627,7 @@ let%expect_test "%log_printbox flushing" = + + + 4/0 4/1 4/2 4/3 4/4 +- bar begin "test/test_expect_test.ml":3588:12: ++ bar begin "test/test_expect_test.ml":3591:12: + "Now with a frame:" + ┌───┬───┬───┬───┬───┐ + │0/0│0/1│0/2│0/3│0/4│ +@@ -3687,7 +3687,7 @@ let%expect_test "%log_entry" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":3648:17: _logging_logic ++ "test/test_expect_test.ml":3651:17: _logging_logic + ├─"preamble" + ├─header 1 + │ ├─"log 1" +@@ -3727,36 +3727,36 @@ let%expect_test "flame graph" = + print_endline output; + [%expect + {| +-
++
+-
++
+-
++
+-
++
+-
++
+- +
+-
++
+-
++
+- +
+-
++
+-
++
+-
++
+-
++
+- +
+-
++
+-
++
+-
++
+- +@@ -3831,31 +3831,31 @@ let%expect_test "flame graph reduced ToC" = + print_endline output; + [%expect + {| +-
++
+-
++
+-
++
+-
++
+-
++ +
+-
++
+- +
+-
++
+-
++
+-
++
+-
++ +
+-
++
+-
++
+- +@@ -3913,10 +3913,10 @@ let%expect_test "%debug_show skip module bindings" = + {| + BEGIN DEBUG SESSION + bar = 15 +- ├─"test/test_expect_test.ml":3898:21 ++ ├─"test/test_expect_test.ml":3901:21 + ├─x = 7 + └─y = 8 +- └─"test/test_expect_test.ml":3900:8 ++ └─"test/test_expect_test.ml":3903:8 + 15 + |}] + +@@ -3942,52 +3942,52 @@ let%expect_test "%track_l_show procedure runtime passing" = + [%expect + {| + BEGIN DEBUG SESSION foo-1 +- foo-1 foo begin "test/test_expect_test.ml":3925:28: ++ foo-1 foo begin "test/test_expect_test.ml":3928:28: + "inside foo" + foo-1 foo end + + BEGIN DEBUG SESSION foo-1 +- foo-1 () begin "test/test_expect_test.ml":3931:8: ++ foo-1 () begin "test/test_expect_test.ml":3934:8: + "inside bar" + foo-1 () end + + BEGIN DEBUG SESSION foo-2 +- foo-2 foo begin "test/test_expect_test.ml":3925:28: ++ foo-2 foo begin "test/test_expect_test.ml":3928:28: + "inside foo" + foo-2 foo end + + BEGIN DEBUG SESSION foo-2 +- foo-2 () begin "test/test_expect_test.ml":3931:8: ++ foo-2 () begin "test/test_expect_test.ml":3934:8: + "inside bar" + foo-2 () end + + BEGIN DEBUG SESSION foo-3 +- foo-3 foo begin "test/test_expect_test.ml":3925:28: ++ foo-3 foo begin "test/test_expect_test.ml":3928:28: + "inside foo" + foo-3 foo end + + BEGIN DEBUG SESSION foo-3 +- foo-3 () begin "test/test_expect_test.ml":3931:8: ++ foo-3 () begin "test/test_expect_test.ml":3934:8: + "inside bar" + foo-3 () end + + BEGIN DEBUG SESSION foo-4 +- foo-4 foo begin "test/test_expect_test.ml":3925:28: ++ foo-4 foo begin "test/test_expect_test.ml":3928:28: + "inside foo" + foo-4 foo end + + BEGIN DEBUG SESSION foo-4 +- foo-4 () begin "test/test_expect_test.ml":3931:8: ++ foo-4 () begin "test/test_expect_test.ml":3934:8: + "inside bar" + foo-4 () end + + BEGIN DEBUG SESSION foo-5 +- foo-5 foo begin "test/test_expect_test.ml":3925:28: ++ foo-5 foo begin "test/test_expect_test.ml":3928:28: + "inside foo" + foo-5 foo end + + BEGIN DEBUG SESSION foo-5 +- foo-5 () begin "test/test_expect_test.ml":3931:8: ++ foo-5 () begin "test/test_expect_test.ml":3934:8: + "inside bar" + foo-5 () end + |}] +@@ -4047,18 +4047,18 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + ┌─────────┐ + │bar = 336│ + ├─────────┘ +- ├─"test/test_expect_test.ml":4028:21 ++ ├─"test/test_expect_test.ml":4031:21 + ├─first = 7 + ├─second = 42 + └─┬─────┐ + │y = 8│ + ├─────┘ +- └─"test/test_expect_test.ml":4029:8 ++ └─"test/test_expect_test.ml":4032:8 + 336 + ┌────────┐ + │(r1, r2)│ + ├────────┘ +- ├─"test/test_expect_test.ml":4038:6 ++ ├─"test/test_expect_test.ml":4041:6 + ├─┬─────────┐ + │ ││ + │ ├─────────┘ +@@ -4069,13 +4069,13 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + └─┬────────────────┐ + │baz = (339, 109)│ + ├────────────────┘ +- ├─"test/test_expect_test.ml":4033:10 ++ ├─"test/test_expect_test.ml":4036:10 + ├─first = 7 + ├─second = 42 + ├─┬──────┐ + │ │(y, z)│ + │ ├──────┘ +- │ ├─"test/test_expect_test.ml":4034:8 ++ │ ├─"test/test_expect_test.ml":4037:8 + │ └─┬────────┐ + │ ││ + │ ├────────┘ +@@ -4086,7 +4086,7 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + └─┬──────┐ + │(a, b)│ + ├──────┘ +- ├─"test/test_expect_test.ml":4035:8 ++ ├─"test/test_expect_test.ml":4038:8 + └─┬────────┐ + ││ + ├────────┘ diff --git a/test-debug.log b/test-debug.log new file mode 100644 index 0000000..15d37d6 --- /dev/null +++ b/test-debug.log @@ -0,0 +1,2458 @@ +File "test/test_debug_sexp.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_sexp.expected.ml b/_build/default/test/test_debug_sexp.actual.ml +index c06f791..f1d2fdc 100644 +--- a/_build/default/test/test_debug_sexp.expected.ml ++++ b/_build/default/test/test_debug_sexp.actual.ml +@@ -6,20 +6,20 @@ let foo (x : int) = + (); + (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:7 + ~start_colnum:19 ~end_lnum:9 ~end_colnum:17 ~message:"foo" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%sexp_of : int]) x)); ++ ~log_level:1 ~is_result:false (([%sexp_of : int]) x)); + (match let y : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:8 + ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:8 ~entry_id:__entry_id; +@@ -32,7 +32,7 @@ let foo (x : int) = + with + | __res -> + (Debug_runtime.log_value_sexp ?descr:(Some "foo") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int list]) __res); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:7 + ~entry_id:__entry_id; +@@ -50,20 +50,20 @@ let bar (x : t) = + (); + (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:15 + ~start_colnum:19 ~end_lnum:17 ~end_colnum:14 ~message:"bar" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%sexp_of : t]) x)); ++ ~log_level:1 ~is_result:false (([%sexp_of : t]) x)); + (match let y : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:16 + ~start_colnum:6 ~end_lnum:16 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x.first + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:16 ~entry_id:__entry_id; +@@ -76,7 +76,8 @@ let bar (x : t) = + with + | __res -> + (Debug_runtime.log_value_sexp ?descr:(Some "bar") +- ~entry_id:__entry_id ~is_result:true (([%sexp_of : int]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%sexp_of : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:15 + ~entry_id:__entry_id; + __res) +@@ -90,20 +91,20 @@ let baz (x : t) = + (); + (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:21 + ~start_colnum:19 ~end_lnum:24 ~end_colnum:28 ~message:"baz" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%sexp_of : t]) x)); ++ ~log_level:1 ~is_result:false (([%sexp_of : t]) x)); + (match let (((y, z) as _yz) : (int * int)) = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:22 + ~start_colnum:17 ~end_lnum:22 ~end_colnum:20 ~message:"_yz" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match ((x.first + 1), 3) with + | _yz as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "_yz") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : (int * int)]) _yz)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:22 ~entry_id:__entry_id; +@@ -117,12 +118,12 @@ let baz (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:23 + ~start_colnum:17 ~end_lnum:23 ~end_colnum:20 ~message:"_uw" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match (7, 13) with + | _uw as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "_uw") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : (int * int)]) _uw)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:23 ~entry_id:__entry_id; +@@ -135,7 +136,8 @@ let baz (x : t) = + with + | __res -> + (Debug_runtime.log_value_sexp ?descr:(Some "baz") +- ~entry_id:__entry_id ~is_result:true (([%sexp_of : int]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%sexp_of : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:21 + ~entry_id:__entry_id; + __res) +@@ -149,20 +151,20 @@ let lab ~x:(x : int) = + (); + (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:28 + ~start_colnum:19 ~end_lnum:30 ~end_colnum:17 ~message:"lab" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%sexp_of : int]) x)); ++ ~log_level:1 ~is_result:false (([%sexp_of : int]) x)); + (match let y : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:29 + ~start_colnum:6 ~end_lnum:29 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:29 ~entry_id:__entry_id; +@@ -175,7 +177,7 @@ let lab ~x:(x : int) = + with + | __res -> + (Debug_runtime.log_value_sexp ?descr:(Some "lab") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int list]) __res); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:28 + ~entry_id:__entry_id; +@@ -190,11 +192,11 @@ let rec loop (depth : int) (x : t) = + (); + ((Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:34 + ~start_colnum:24 ~end_lnum:40 ~end_colnum:9 ~message:"loop" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_sexp ?descr:(Some "depth") ~entry_id:__entry_id +- ~is_result:false (([%sexp_of : int]) depth)); ++ ~log_level:1 ~is_result:false (([%sexp_of : int]) depth)); + Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%sexp_of : t]) x)); ++ ~log_level:1 ~is_result:false (([%sexp_of : t]) x)); + (match if depth > 4 + then x.first + x.second + else +@@ -208,14 +210,14 @@ let rec loop (depth : int) (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" + ~start_lnum:38 ~start_colnum:8 ~end_lnum:38 ~end_colnum:9 +- ~message:"y" ~entry_id:__entry_id; ++ ~message:"y" ~entry_id:__entry_id ~log_level:1; + (match loop (depth + 1) + { first = (x.second - 1); second = (x.first + 2) } + with + | y as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:38 ~entry_id:__entry_id; +@@ -229,14 +231,14 @@ let rec loop (depth : int) (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_sexp.ml" + ~start_lnum:39 ~start_colnum:8 ~end_lnum:39 ~end_colnum:9 +- ~message:"z" ~entry_id:__entry_id; ++ ~message:"z" ~entry_id:__entry_id ~log_level:1; + (match loop (depth + 1) + { first = (x.second + 1); second = y } + with + | z as __res -> + (((); + Debug_runtime.log_value_sexp ?descr:(Some "z") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) z)); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" + ~start_lnum:39 ~entry_id:__entry_id; +@@ -249,7 +251,8 @@ let rec loop (depth : int) (x : t) = + with + | __res -> + (Debug_runtime.log_value_sexp ?descr:(Some "loop") +- ~entry_id:__entry_id ~is_result:true (([%sexp_of : int]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%sexp_of : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:34 + ~entry_id:__entry_id; + __res) +File "test/test_debug_pp.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_pp.expected.ml b/_build/default/test/test_debug_pp.actual.ml +index be68a7e..d0f1d29 100644 +--- a/_build/default/test/test_debug_pp.expected.ml ++++ b/_build/default/test/test_debug_pp.actual.ml +@@ -9,20 +9,21 @@ let bar (x : t) = + (); + (Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:7 + ~start_colnum:17 ~end_lnum:9 ~end_colnum:14 ~message:"bar" +- ~entry_id:__entry_id; +- Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp +- ~is_result:false x); ++ ~entry_id:__entry_id ~log_level:1; ++ Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ++ ~log_level:1 ~pp ~is_result:false x); + (match let y : num = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:8 + ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x.first + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "y") +- ~entry_id:__entry_id ~pp:pp_num ~is_result:true y); ++ ~entry_id:__entry_id ~log_level:1 ~pp:pp_num ++ ~is_result:true y); + Debug_runtime.close_log ~fname:"test_debug_pp.ml" + ~start_lnum:8 ~entry_id:__entry_id; + __res) +@@ -34,7 +35,7 @@ let bar (x : t) = + with + | __res -> + (Debug_runtime.log_value_pp ?descr:(Some "bar") ~entry_id:__entry_id +- ~pp:pp_num ~is_result:true __res; ++ ~log_level:1 ~pp:pp_num ~is_result:true __res; + Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:7 + ~entry_id:__entry_id; + __res) +@@ -48,20 +49,21 @@ let baz (x : t) = + (); + (Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:13 + ~start_colnum:17 ~end_lnum:15 ~end_colnum:20 ~message:"baz" +- ~entry_id:__entry_id; +- Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp +- ~is_result:false x); ++ ~entry_id:__entry_id ~log_level:1; ++ Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ++ ~log_level:1 ~pp ~is_result:false x); + (match let (({ first = y; second = z } as _yz) : t) = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:14 + ~start_colnum:36 ~end_lnum:14 ~end_colnum:39 ~message:"_yz" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match { first = (x.first + 1); second = 3 } with + | _yz as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "_yz") +- ~entry_id:__entry_id ~pp ~is_result:true _yz); ++ ~entry_id:__entry_id ~log_level:1 ~pp ~is_result:true ++ _yz); + Debug_runtime.close_log ~fname:"test_debug_pp.ml" + ~start_lnum:14 ~entry_id:__entry_id; + __res) +@@ -73,7 +75,7 @@ let baz (x : t) = + with + | __res -> + (Debug_runtime.log_value_pp ?descr:(Some "baz") ~entry_id:__entry_id +- ~pp:pp_num ~is_result:true __res; ++ ~log_level:1 ~pp:pp_num ~is_result:true __res; + Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:13 + ~entry_id:__entry_id; + __res) +@@ -87,11 +89,11 @@ let rec loop (depth : num) (x : t) = + (); + ((Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:19 + ~start_colnum:22 ~end_lnum:25 ~end_colnum:9 ~message:"loop" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_pp ?descr:(Some "depth") ~entry_id:__entry_id +- ~pp:pp_num ~is_result:false depth); +- Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp +- ~is_result:false x); ++ ~log_level:1 ~pp:pp_num ~is_result:false depth); ++ Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ++ ~log_level:1 ~pp ~is_result:false x); + (match if depth > 6 + then x.first + x.second + else +@@ -105,14 +107,15 @@ let rec loop (depth : num) (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_pp.ml" + ~start_lnum:23 ~start_colnum:8 ~end_lnum:23 ~end_colnum:9 +- ~message:"y" ~entry_id:__entry_id; ++ ~message:"y" ~entry_id:__entry_id ~log_level:1; + (match loop (depth + 1) + { first = (x.second - 1); second = (x.first + 2) } + with + | y as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "y") +- ~entry_id:__entry_id ~pp:pp_num ~is_result:true y); ++ ~entry_id:__entry_id ~log_level:1 ~pp:pp_num ++ ~is_result:true y); + Debug_runtime.close_log ~fname:"test_debug_pp.ml" + ~start_lnum:23 ~entry_id:__entry_id; + __res) +@@ -125,14 +128,15 @@ let rec loop (depth : num) (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_pp.ml" + ~start_lnum:24 ~start_colnum:8 ~end_lnum:24 ~end_colnum:9 +- ~message:"z" ~entry_id:__entry_id; ++ ~message:"z" ~entry_id:__entry_id ~log_level:1; + (match loop (depth + 1) + { first = (x.second + 1); second = y } + with + | z as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "z") +- ~entry_id:__entry_id ~pp:pp_num ~is_result:true z); ++ ~entry_id:__entry_id ~log_level:1 ~pp:pp_num ++ ~is_result:true z); + Debug_runtime.close_log ~fname:"test_debug_pp.ml" + ~start_lnum:24 ~entry_id:__entry_id; + __res) +@@ -144,7 +148,7 @@ let rec loop (depth : num) (x : t) = + with + | __res -> + (Debug_runtime.log_value_pp ?descr:(Some "loop") ~entry_id:__entry_id +- ~pp:pp_num ~is_result:true __res; ++ ~log_level:1 ~pp:pp_num ~is_result:true __res; + Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:19 + ~entry_id:__entry_id; + __res) +File "test/test_debug_show.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_show.expected.ml b/_build/default/test/test_debug_show.actual.ml +index a2d0f07..b2c6499 100644 +--- a/_build/default/test/test_debug_show.expected.ml ++++ b/_build/default/test/test_debug_show.actual.ml +@@ -5,20 +5,21 @@ let foo (x : int) = + (); + (Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:4 + ~start_colnum:19 ~end_lnum:6 ~end_colnum:17 ~message:"foo" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%show : int]) x)); ++ ~log_level:1 ~is_result:false (([%show : int]) x)); + (match let y : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:5 + ~start_colnum:6 ~end_lnum:5 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true (([%show : int]) y)); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_show.ml" + ~start_lnum:5 ~entry_id:__entry_id; + __res) +@@ -30,7 +31,8 @@ let foo (x : int) = + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "foo") +- ~entry_id:__entry_id ~is_result:true (([%show : int list]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int list]) __res); + Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:4 + ~entry_id:__entry_id; + __res) +@@ -47,20 +49,21 @@ let bar (x : t) = + (); + (Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:12 + ~start_colnum:19 ~end_lnum:14 ~end_colnum:14 ~message:"bar" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%show : t]) x)); ++ ~log_level:1 ~is_result:false (([%show : t]) x)); + (match let y : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:13 + ~start_colnum:6 ~end_lnum:13 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x.first + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true (([%show : int]) y)); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_show.ml" + ~start_lnum:13 ~entry_id:__entry_id; + __res) +@@ -72,7 +75,8 @@ let bar (x : t) = + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "bar") +- ~entry_id:__entry_id ~is_result:true (([%show : int]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:12 + ~entry_id:__entry_id; + __res) +@@ -86,20 +90,20 @@ let baz (x : t) = + (); + (Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:18 + ~start_colnum:19 ~end_lnum:20 ~end_colnum:20 ~message:"baz" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%show : t]) x)); ++ ~log_level:1 ~is_result:false (([%show : t]) x)); + (match let (((y, z) as _yz) : (int * int)) = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:19 + ~start_colnum:17 ~end_lnum:19 ~end_colnum:20 ~message:"_yz" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match ((x.first + 1), 3) with + | _yz as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "_yz") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : (int * int)]) _yz)); + Debug_runtime.close_log ~fname:"test_debug_show.ml" + ~start_lnum:19 ~entry_id:__entry_id; +@@ -112,7 +116,8 @@ let baz (x : t) = + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "baz") +- ~entry_id:__entry_id ~is_result:true (([%show : int]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:18 + ~entry_id:__entry_id; + __res) +@@ -126,11 +131,11 @@ let rec loop (depth : int) (x : t) = + (); + ((Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:24 + ~start_colnum:24 ~end_lnum:30 ~end_colnum:9 ~message:"loop" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "depth") ~entry_id:__entry_id +- ~is_result:false (([%show : int]) depth)); ++ ~log_level:1 ~is_result:false (([%show : int]) depth)); + Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%show : t]) x)); ++ ~log_level:1 ~is_result:false (([%show : t]) x)); + (match if depth > 6 + then x.first + x.second + else +@@ -144,14 +149,14 @@ let rec loop (depth : int) (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_show.ml" + ~start_lnum:28 ~start_colnum:8 ~end_lnum:28 ~end_colnum:9 +- ~message:"y" ~entry_id:__entry_id; ++ ~message:"y" ~entry_id:__entry_id ~log_level:1; + (match loop (depth + 1) + { first = (x.second - 1); second = (x.first + 2) } + with + | y as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) y)); + Debug_runtime.close_log ~fname:"test_debug_show.ml" + ~start_lnum:28 ~entry_id:__entry_id; +@@ -165,14 +170,14 @@ let rec loop (depth : int) (x : t) = + (); + Debug_runtime.open_log ~fname:"test_debug_show.ml" + ~start_lnum:29 ~start_colnum:8 ~end_lnum:29 ~end_colnum:9 +- ~message:"z" ~entry_id:__entry_id; ++ ~message:"z" ~entry_id:__entry_id ~log_level:1; + (match loop (depth + 1) + { first = (x.second + 1); second = y } + with + | z as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "z") +- ~entry_id:__entry_id ~is_result:true ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) z)); + Debug_runtime.close_log ~fname:"test_debug_show.ml" + ~start_lnum:29 ~entry_id:__entry_id; +@@ -185,7 +190,8 @@ let rec loop (depth : int) (x : t) = + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "loop") +- ~entry_id:__entry_id ~is_result:true (([%show : int]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:24 + ~entry_id:__entry_id; + __res) +File "test/test_debug_unannot_bindings.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_unannot_bindings.expected.ml b/_build/default/test/test_debug_unannot_bindings.actual.ml +index 2a0cf69..224d767 100644 +--- a/_build/default/test/test_debug_unannot_bindings.expected.ml ++++ b/_build/default/test/test_debug_unannot_bindings.actual.ml +@@ -5,7 +5,7 @@ let _result = + (); + Debug_runtime.open_log ~fname:"test_debug_unannot_bindings.ml" + ~start_lnum:4 ~start_colnum:15 ~end_lnum:4 ~end_colnum:22 +- ~message:"_result" ~entry_id:__entry_id; ++ ~message:"_result" ~entry_id:__entry_id ~log_level:1; + (match let a = 1 in let b = 2 in let point = (a, b) in ignore point with + | _ as __res -> + ((); +File "test/test_debug_interrupts.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_interrupts.expected.ml b/_build/default/test/test_debug_interrupts.actual.ml +index 25faa57..eb1c9bb 100644 +--- a/_build/default/test/test_debug_interrupts.expected.ml ++++ b/_build/default/test/test_debug_interrupts.actual.ml +@@ -9,18 +9,20 @@ let rec loop_exceeded (x : int) = + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"loop_exceeded" +- ~entry_id:__entry_id ~is_result:false ""; ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false ++ ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + ((Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:7 + ~start_colnum:33 ~end_lnum:9 ~end_colnum:55 +- ~message:"loop_exceeded : int" ~entry_id:__entry_id; ++ ~message:"loop_exceeded : int" ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x : int") +- ~entry_id:__entry_id ~is_result:false (([%show : int]) x)); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false ++ (([%show : int]) x)); + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"loop_exceeded" +- ~entry_id:__entry_id ~is_result:false ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false + ""; + Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" + ~start_lnum:7 ~entry_id:__entry_id; +@@ -32,17 +34,17 @@ let rec loop_exceeded (x : int) = + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"z" +- ~entry_id:__entry_id ~is_result:false ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false + ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" + ~start_lnum:8 ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 +- ~message:"z" ~entry_id:__entry_id; ++ ~message:"z" ~entry_id:__entry_id ~log_level:1; + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"z" +- ~entry_id:__entry_id ~is_result:false ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false + ""; + Debug_runtime.close_log + ~fname:"test_debug_interrupts.ml" ~start_lnum:8 +@@ -54,7 +56,8 @@ let rec loop_exceeded (x : int) = + (((); + Debug_runtime.log_value_show + ?descr:(Some "z : int") ~entry_id:__entry_id +- ~is_result:true (([%show : int]) z)); ++ ~log_level:1 ~is_result:true ++ (([%show : int]) z)); + Debug_runtime.close_log + ~fname:"test_debug_interrupts.ml" ~start_lnum:8 + ~entry_id:__entry_id; +@@ -69,7 +72,7 @@ let rec loop_exceeded (x : int) = + | __res -> + (Debug_runtime.log_value_show + ?descr:(Some "loop_exceeded : int") ~entry_id:__entry_id +- ~is_result:true (([%show : int]) __res); ++ ~log_level:1 ~is_result:true (([%show : int]) __res); + Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" + ~start_lnum:7 ~entry_id:__entry_id; + __res) +@@ -86,16 +89,16 @@ let bar () = + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"bar" ~entry_id:__entry_id +- ~is_result:false ""; ++ ~log_level:1 ~is_result:false ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:15 + ~start_colnum:19 ~end_lnum:19 ~end_colnum:6 ~message:"bar : unit" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"bar" ~entry_id:__entry_id +- ~is_result:false ""; ++ ~log_level:1 ~is_result:false ""; + Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" + ~start_lnum:15 ~entry_id:__entry_id; + failwith "ppx_minidebug: max_nesting_depth exceeded") +@@ -103,28 +106,31 @@ let bar () = + (match let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" + ~start_lnum:16 ~start_colnum:2 ~end_lnum:19 ~end_colnum:6 +- ~message:"for:test_debug_interrupts:16" ~entry_id:__entry_id; ++ ~message:"for:test_debug_interrupts:16" ~entry_id:__entry_id ++ ~log_level:1; + (match for i = 0 to 100 do + let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.log_value_show ?descr:(Some "i : int") +- ~entry_id:__entry_id ~is_result:false ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false + (([%show : int]) i); + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"i" +- ~entry_id:__entry_id ~is_result:false +- ""; ++ ~entry_id:__entry_id ~log_level:1 ++ ~is_result:false ""; + failwith + "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log + ~fname:"test_debug_interrupts.ml" ~start_lnum:16 + ~start_colnum:6 ~end_lnum:16 ~end_colnum:7 +- ~message:"" ~entry_id:__entry_id; ++ ~message:"" ~entry_id:__entry_id ++ ~log_level:1; + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"i" +- ~entry_id:__entry_id ~is_result:false ++ ~entry_id:__entry_id ~log_level:1 ++ ~is_result:false + ""; + Debug_runtime.close_log + ~fname:"test_debug_interrupts.ml" +@@ -141,7 +147,7 @@ let bar () = + then + (Debug_runtime.log_value_show + ~descr:"_baz" ~entry_id:__entry_id +- ~is_result:false ++ ~log_level:1 ~is_result:false + ""; + failwith + "ppx_minidebug: max_num_children exceeded") +@@ -151,7 +157,7 @@ let bar () = + ~start_lnum:17 ~start_colnum:8 + ~end_lnum:17 ~end_colnum:12 + ~message:"_baz" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + if + Debug_runtime.exceeds_max_nesting + () +@@ -159,7 +165,7 @@ let bar () = + (Debug_runtime.log_value_show + ~descr:"_baz" + ~entry_id:__entry_id +- ~is_result:false ++ ~log_level:1 ~is_result:false + ""; + Debug_runtime.close_log + ~fname:"test_debug_interrupts.ml" +@@ -174,6 +180,7 @@ let bar () = + Debug_runtime.log_value_show + ?descr:(Some "_baz : int") + ~entry_id:__entry_id ++ ~log_level:1 + ~is_result:true + (([%show : int]) _baz)); + Debug_runtime.close_log +@@ -213,7 +220,8 @@ let bar () = + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "bar : unit") +- ~entry_id:__entry_id ~is_result:true (([%show : unit]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : unit]) __res); + Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" + ~start_lnum:15 ~entry_id:__entry_id; + __res) +File "test/test_debug_log_level_consistency.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_log_level_consistency.expected.ml b/_build/default/test/test_debug_log_level_consistency.actual.ml +index b50465a..43e8ebe 100644 +--- a/_build/default/test/test_debug_log_level_consistency.expected.ml ++++ b/_build/default/test/test_debug_log_level_consistency.actual.ml +@@ -6,12 +6,12 @@ module Debug_runtime = (val + (Stdlib.Sys.getenv "PPX_MINIDEBUG_TEST_LOG_LEVEL_CONSISTENCY") in + if + (not (Stdlib.String.equal "" runtime_log_level)) && +- (not (Stdlib.String.equal "everything" runtime_log_level)) ++ (not (Stdlib.String.equal "9" runtime_log_level)) + then + failwith + ("ppx_minidebug: compile-time vs. runtime log level mismatch, found '" + ^ +- ("everything" ^ ++ ("9" ^ + ("' at compile time, '" ^ (runtime_log_level ^ "' at runtime")))) + with | Stdlib.Not_found -> () + let foo (x : int) = +@@ -19,21 +19,22 @@ let foo (x : int) = + (); + (Debug_runtime.open_log ~fname:"test_debug_log_level_consistency.ml" + ~start_lnum:7 ~start_colnum:19 ~end_lnum:9 ~end_colnum:17 +- ~message:"foo" ~entry_id:__entry_id; ++ ~message:"foo" ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id +- ~is_result:false (([%show : int]) x)); ++ ~log_level:1 ~is_result:false (([%show : int]) x)); + (match let y : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log + ~fname:"test_debug_log_level_consistency.ml" ~start_lnum:8 + ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"y" +- ~entry_id:__entry_id; ++ ~entry_id:__entry_id ~log_level:1; + (match x + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "y") +- ~entry_id:__entry_id ~is_result:true (([%show : int]) y)); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int]) y)); + Debug_runtime.close_log + ~fname:"test_debug_log_level_consistency.ml" + ~start_lnum:8 ~entry_id:__entry_id; +@@ -47,7 +48,8 @@ let foo (x : int) = + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "foo") +- ~entry_id:__entry_id ~is_result:true (([%show : int list]) __res); ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : int list]) __res); + Debug_runtime.close_log ~fname:"test_debug_log_level_consistency.ml" + ~start_lnum:7 ~entry_id:__entry_id; + __res) +File "test/test_debug_log_prefixed.expected.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_debug_log_prefixed.expected.ml b/_build/default/test/test_debug_log_prefixed.actual.ml +index b747c8b..7f6b789 100644 +--- a/_build/default/test/test_debug_log_prefixed.expected.ml ++++ b/_build/default/test/test_debug_log_prefixed.actual.ml +@@ -5,13 +5,14 @@ let rec loop_exceeded (x : int) = + (let __entry_id = Debug_runtime.get_entry_id () in + (); + (Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:6 +- ~start_colnum:33 ~end_lnum:11 ~end_colnum:55 ~message:"loop_exceeded" +- ~entry_id:__entry_id; ++ ~start_colnum:33 ~end_lnum:12 ~end_colnum:55 ~message:"loop_exceeded" ++ ~entry_id:__entry_id ~log_level:1; + ()); + (match let z : int = + Debug_runtime.log_value_show ?descr:None ~entry_id:__entry_id +- ~is_result:false +- (([%show : (string * int)]) ("INFO: inside loop", (x : int))); ++ ~log_level:2 ~is_result:false ++ (([%show : (string * int)]) ("inside loop", (x : int))); ++ (); + (x - 1) / 2 in + if x <= 0 then 0 else z + (loop_exceeded (z + (x / 2))) + with +@@ -30,54 +31,85 @@ let () = + let bar () = + (let __entry_id = Debug_runtime.get_entry_id () in + (); +- Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:17 +- ~start_colnum:19 ~end_lnum:21 ~end_colnum:6 ~message:"bar" +- ~entry_id:__entry_id; ++ Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:18 ++ ~start_colnum:19 ~end_lnum:23 ~end_colnum:6 ~message:"bar" ++ ~entry_id:__entry_id ~log_level:1; + (match let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" +- ~start_lnum:18 ~start_colnum:2 ~end_lnum:21 ~end_colnum:6 +- ~message:"for:test_debug_log_prefixed:18" ~entry_id:__entry_id; ++ ~start_lnum:19 ~start_colnum:2 ~end_lnum:23 ~end_colnum:6 ++ ~message:"for:test_debug_log_prefixed:19" ~entry_id:__entry_id ++ ~log_level:1; + (match for i = 0 to 10 do + let __entry_id = Debug_runtime.get_entry_id () in +- (); ++ Debug_runtime.log_value_show ?descr:(Some "i") ++ ~entry_id:__entry_id ~log_level:1 ~is_result:false ++ (([%show : int]) i); + Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" +- ~start_lnum:18 ~start_colnum:6 ~end_lnum:18 +- ~end_colnum:7 ~message:"" ~entry_id:__entry_id; +- (match let _baz : int = i * 2 in ++ ~start_lnum:19 ~start_colnum:6 ~end_lnum:19 ++ ~end_colnum:7 ~message:"" ~entry_id:__entry_id ++ ~log_level:1; ++ (match let _baz : int = ++ let __entry_id = Debug_runtime.get_entry_id () in ++ (); ++ Debug_runtime.open_log ++ ~fname:"test_debug_log_prefixed.ml" ++ ~start_lnum:20 ~start_colnum:8 ~end_lnum:20 ++ ~end_colnum:12 ~message:"_baz" ++ ~entry_id:__entry_id ~log_level:1; ++ (match i * 2 with ++ | _baz as __res -> ++ (((); ++ Debug_runtime.log_value_show ++ ?descr:(Some "_baz") ++ ~entry_id:__entry_id ~log_level:1 ++ ~is_result:true (([%show : int]) _baz)); ++ Debug_runtime.close_log ++ ~fname:"test_debug_log_prefixed.ml" ++ ~start_lnum:20 ~entry_id:__entry_id; ++ __res) ++ | exception e -> ++ (Debug_runtime.close_log ++ ~fname:"test_debug_log_prefixed.ml" ++ ~start_lnum:20 ~entry_id:__entry_id; ++ raise e)) in + Debug_runtime.log_value_show ?descr:None +- ~entry_id:__entry_id ~is_result:false ++ ~entry_id:__entry_id ~log_level:2 ++ ~is_result:false + (([%show : (string * int * string * int)]) +- ("INFO: loop step", (i : int), "value", +- (_baz : int))) ++ ("loop step", (i : int), "value", ++ (_baz : int))); ++ () + with + | () -> + ((); + Debug_runtime.close_log +- ~fname:"test_debug_log_prefixed.ml" ~start_lnum:19 ++ ~fname:"test_debug_log_prefixed.ml" ~start_lnum:20 + ~entry_id:__entry_id; + ()) + | exception e -> + (Debug_runtime.close_log +- ~fname:"test_debug_log_prefixed.ml" ~start_lnum:19 ++ ~fname:"test_debug_log_prefixed.ml" ~start_lnum:20 + ~entry_id:__entry_id; + raise e)) + done + with + | () -> + Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" +- ~start_lnum:18 ~entry_id:__entry_id ++ ~start_lnum:19 ~entry_id:__entry_id + | exception e -> + (Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" +- ~start_lnum:18 ~entry_id:__entry_id; ++ ~start_lnum:19 ~entry_id:__entry_id; + raise e)) + with + | __res -> +- ((); ++ (Debug_runtime.log_value_show ?descr:(Some "bar") ++ ~entry_id:__entry_id ~log_level:1 ~is_result:true ++ (([%show : unit]) __res); + Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" +- ~start_lnum:17 ~entry_id:__entry_id; ++ ~start_lnum:18 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" +- ~start_lnum:17 ~entry_id:__entry_id; ++ ~start_lnum:18 ~entry_id:__entry_id; + raise e)) : unit) + let () = try bar () with | _ -> print_endline "Raised exception." +File "test/test_expect_test.ml", line 1, characters 0-0: +diff --git a/_build/default/test/test_expect_test.ml b/_build/.sandbox/51bb9edf9c45b1026661a3436ccebfa0/default/test/test_expect_test.ml.corrected +index ff712cc..8c90266 100644 +--- a/_build/default/test/test_expect_test.ml ++++ b/_build/.sandbox/51bb9edf9c45b1026661a3436ccebfa0/default/test/test_expect_test.ml.corrected +@@ -278,39 +278,40 @@ let%expect_test "%debug_this_show with exception" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":268:41: loop_truncated ++ "test/test_expect_test.ml":269:41: loop_truncated + ├─x = 7 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 3 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 6 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 2 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 5 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 2 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 4 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 1 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 3 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 1 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 2 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 0 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 1 +- ├─"test/test_expect_test.ml":269:8: z ++ ├─"test/test_expect_test.ml":270:8: z + │ └─z = 0 +- └─"test/test_expect_test.ml":268:41: loop_truncated ++ └─"test/test_expect_test.ml":269:41: loop_truncated + ├─x = 0 +- └─"test/test_expect_test.ml":269:8: z ++ └─"test/test_expect_test.ml":270:8: z + └─z = 0 +- Raised exception. |}] ++ Raised exception. ++ |}] + + let%expect_test "%debug_this_show depth exceeded" = + let module Debug_runtime = (val Minidebug_runtime.debug ()) in +@@ -326,28 +327,29 @@ let%expect_test "%debug_this_show depth exceeded" = + in + [%expect + {| +- BEGIN DEBUG SESSION +- "test/test_expect_test.ml":316:40: loop_exceeded +- ├─x = 7 +- ├─"test/test_expect_test.ml":319:10: z +- │ └─z = 3 +- └─"test/test_expect_test.ml":316:40: loop_exceeded +- ├─x = 6 +- ├─"test/test_expect_test.ml":319:10: z ++ BEGIN DEBUG SESSION ++ "test/test_expect_test.ml":317:40: loop_exceeded ++ ├─x = 7 ++ ├─"test/test_expect_test.ml":320:10: z ++ │ └─z = 3 ++ └─"test/test_expect_test.ml":317:40: loop_exceeded ++ ├─x = 6 ++ ├─"test/test_expect_test.ml":320:10: z ++ │ └─z = 2 ++ └─"test/test_expect_test.ml":317:40: loop_exceeded ++ ├─x = 5 ++ ├─"test/test_expect_test.ml":320:10: z + │ └─z = 2 +- └─"test/test_expect_test.ml":316:40: loop_exceeded +- ├─x = 5 +- ├─"test/test_expect_test.ml":319:10: z +- │ └─z = 2 +- └─"test/test_expect_test.ml":316:40: loop_exceeded +- ├─x = 4 +- ├─"test/test_expect_test.ml":319:10: z +- │ └─z = 1 +- └─"test/test_expect_test.ml":316:40: loop_exceeded +- ├─x = 3 +- └─"test/test_expect_test.ml":319:10: z +- └─z = +- Raised exception. |}] ++ └─"test/test_expect_test.ml":317:40: loop_exceeded ++ ├─x = 4 ++ ├─"test/test_expect_test.ml":320:10: z ++ │ └─z = 1 ++ └─"test/test_expect_test.ml":317:40: loop_exceeded ++ ├─x = 3 ++ └─"test/test_expect_test.ml":320:10: z ++ └─z = ++ Raised exception. ++ |}] + + let%expect_test "%debug_this_show num children exceeded linear" = + let module Debug_runtime = (val Minidebug_runtime.debug ()) in +@@ -367,31 +369,32 @@ let%expect_test "%debug_this_show num children exceeded linear" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":355:26: _bar +- ├─"test/test_expect_test.ml":359:16: _baz ++ "test/test_expect_test.ml":356:26: _bar ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 0 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 2 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 4 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 6 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 8 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 10 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 12 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 14 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 16 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 18 +- ├─"test/test_expect_test.ml":359:16: _baz ++ ├─"test/test_expect_test.ml":360:16: _baz + │ └─_baz = 20 + └─_baz = +- Raised exception: ppx_minidebug: max_num_children exceeded |}] ++ Raised exception: ppx_minidebug: max_num_children exceeded ++ |}] + + let%expect_test "%debug_this_show truncated children linear" = + let module Debug_runtime = (val Minidebug_runtime.debug ~truncate_children:10 ()) in +@@ -409,27 +412,28 @@ let%expect_test "%debug_this_show truncated children linear" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":399:26: _bar ++ "test/test_expect_test.ml":400:26: _bar + ├─ +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 44 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 46 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 48 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 50 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 52 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 54 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 56 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 58 +- ├─"test/test_expect_test.ml":401:14: _baz ++ ├─"test/test_expect_test.ml":402:14: _baz + │ └─_baz = 60 +- └─_bar = () |}] ++ └─_bar = () ++ |}] + + let%expect_test "%track_this_show track for-loop num children exceeded" = + let module Debug_runtime = (val Minidebug_runtime.debug ()) in +@@ -449,31 +453,32 @@ let%expect_test "%track_this_show track for-loop num children exceeded" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":437:26: _bar +- └─"test/test_expect_test.ml":440:10: for:test_expect_test:440 ++ "test/test_expect_test.ml":438:26: _bar ++ └─"test/test_expect_test.ml":441:10: for:test_expect_test:441 + ├─i = 0 +- ├─"test/test_expect_test.ml":440:14: +- │ └─"test/test_expect_test.ml":441:16: _baz ++ ├─"test/test_expect_test.ml":441:14: ++ │ └─"test/test_expect_test.ml":442:16: _baz + │ └─_baz = 0 + ├─i = 1 +- ├─"test/test_expect_test.ml":440:14: +- │ └─"test/test_expect_test.ml":441:16: _baz ++ ├─"test/test_expect_test.ml":441:14: ++ │ └─"test/test_expect_test.ml":442:16: _baz + │ └─_baz = 2 + ├─i = 2 +- ├─"test/test_expect_test.ml":440:14: +- │ └─"test/test_expect_test.ml":441:16: _baz ++ ├─"test/test_expect_test.ml":441:14: ++ │ └─"test/test_expect_test.ml":442:16: _baz + │ └─_baz = 4 + ├─i = 3 +- ├─"test/test_expect_test.ml":440:14: +- │ └─"test/test_expect_test.ml":441:16: _baz ++ ├─"test/test_expect_test.ml":441:14: ++ │ └─"test/test_expect_test.ml":442:16: _baz + │ └─_baz = 6 + ├─i = 4 +- ├─"test/test_expect_test.ml":440:14: +- │ └─"test/test_expect_test.ml":441:16: _baz ++ ├─"test/test_expect_test.ml":441:14: ++ │ └─"test/test_expect_test.ml":442:16: _baz + │ └─_baz = 8 + ├─i = 5 + └─i = +- Raised exception: ppx_minidebug: max_num_children exceeded |}] ++ Raised exception: ppx_minidebug: max_num_children exceeded ++ |}] + + let%expect_test "%track_this_show track for-loop truncated children" = + let module Debug_runtime = (val Minidebug_runtime.debug ~truncate_children:10 ()) in +@@ -491,30 +496,31 @@ let%expect_test "%track_this_show track for-loop truncated children" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":481:26: _bar +- ├─"test/test_expect_test.ml":482:8: for:test_expect_test:482 ++ "test/test_expect_test.ml":482:26: _bar ++ ├─"test/test_expect_test.ml":483:8: for:test_expect_test:483 + │ ├─ + │ ├─i = 26 +- │ ├─"test/test_expect_test.ml":482:12: +- │ │ └─"test/test_expect_test.ml":483:14: _baz ++ │ ├─"test/test_expect_test.ml":483:12: ++ │ │ └─"test/test_expect_test.ml":484:14: _baz + │ │ └─_baz = 52 + │ ├─i = 27 +- │ ├─"test/test_expect_test.ml":482:12: +- │ │ └─"test/test_expect_test.ml":483:14: _baz ++ │ ├─"test/test_expect_test.ml":483:12: ++ │ │ └─"test/test_expect_test.ml":484:14: _baz + │ │ └─_baz = 54 + │ ├─i = 28 +- │ ├─"test/test_expect_test.ml":482:12: +- │ │ └─"test/test_expect_test.ml":483:14: _baz ++ │ ├─"test/test_expect_test.ml":483:12: ++ │ │ └─"test/test_expect_test.ml":484:14: _baz + │ │ └─_baz = 56 + │ ├─i = 29 +- │ ├─"test/test_expect_test.ml":482:12: +- │ │ └─"test/test_expect_test.ml":483:14: _baz ++ │ ├─"test/test_expect_test.ml":483:12: ++ │ │ └─"test/test_expect_test.ml":484:14: _baz + │ │ └─_baz = 58 + │ ├─i = 30 +- │ └─"test/test_expect_test.ml":482:12: +- │ └─"test/test_expect_test.ml":483:14: _baz ++ │ └─"test/test_expect_test.ml":483:12: ++ │ └─"test/test_expect_test.ml":484:14: _baz + │ └─_baz = 60 +- └─_bar = () |}] ++ └─_bar = () ++ |}] + + let%expect_test "%track_this_show track for-loop" = + let module Debug_runtime = (val Minidebug_runtime.debug ()) in +@@ -533,38 +539,39 @@ let%expect_test "%track_this_show track for-loop" = + in + [%expect + {| +- BEGIN DEBUG SESSION +- "test/test_expect_test.ml":522:26: _bar +- ├─"test/test_expect_test.ml":525:10: for:test_expect_test:525 +- │ ├─i = 0 +- │ ├─"test/test_expect_test.ml":525:14: +- │ │ └─"test/test_expect_test.ml":526:16: _baz +- │ │ └─_baz = 0 +- │ ├─i = 1 +- │ ├─"test/test_expect_test.ml":525:14: +- │ │ └─"test/test_expect_test.ml":526:16: _baz +- │ │ └─_baz = 2 +- │ ├─i = 2 +- │ ├─"test/test_expect_test.ml":525:14: +- │ │ └─"test/test_expect_test.ml":526:16: _baz +- │ │ └─_baz = 4 +- │ ├─i = 3 +- │ ├─"test/test_expect_test.ml":525:14: +- │ │ └─"test/test_expect_test.ml":526:16: _baz +- │ │ └─_baz = 6 +- │ ├─i = 4 +- │ ├─"test/test_expect_test.ml":525:14: +- │ │ └─"test/test_expect_test.ml":526:16: _baz +- │ │ └─_baz = 8 +- │ ├─i = 5 +- │ ├─"test/test_expect_test.ml":525:14: +- │ │ └─"test/test_expect_test.ml":526:16: _baz +- │ │ └─_baz = 10 +- │ ├─i = 6 +- │ └─"test/test_expect_test.ml":525:14: +- │ └─"test/test_expect_test.ml":526:16: _baz +- │ └─_baz = 12 +- └─_bar = () |}] ++ BEGIN DEBUG SESSION ++ "test/test_expect_test.ml":523:26: _bar ++ ├─"test/test_expect_test.ml":526:10: for:test_expect_test:526 ++ │ ├─i = 0 ++ │ ├─"test/test_expect_test.ml":526:14: ++ │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ │ └─_baz = 0 ++ │ ├─i = 1 ++ │ ├─"test/test_expect_test.ml":526:14: ++ │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ │ └─_baz = 2 ++ │ ├─i = 2 ++ │ ├─"test/test_expect_test.ml":526:14: ++ │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ │ └─_baz = 4 ++ │ ├─i = 3 ++ │ ├─"test/test_expect_test.ml":526:14: ++ │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ │ └─_baz = 6 ++ │ ├─i = 4 ++ │ ├─"test/test_expect_test.ml":526:14: ++ │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ │ └─_baz = 8 ++ │ ├─i = 5 ++ │ ├─"test/test_expect_test.ml":526:14: ++ │ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ │ └─_baz = 10 ++ │ ├─i = 6 ++ │ └─"test/test_expect_test.ml":526:14: ++ │ └─"test/test_expect_test.ml":527:16: _baz ++ │ └─_baz = 12 ++ └─_bar = () ++ |}] + + let%expect_test "%track_this_show track for-loop, time spans" = + let module Debug_runtime = (val Minidebug_runtime.debug ~elapsed_times:Microseconds ()) +@@ -589,38 +596,39 @@ let%expect_test "%track_this_show track for-loop, time spans" = + print_endline output; + [%expect + {| +- BEGIN DEBUG SESSION +- "test/test_expect_test.ml":573:26: _bar +- ├─"test/test_expect_test.ml":576:10: for:test_expect_test:576 +- │ ├─i = 0 +- │ ├─"test/test_expect_test.ml":576:14: +- │ │ └─"test/test_expect_test.ml":577:16: _baz +- │ │ └─_baz = 0 +- │ ├─i = 1 +- │ ├─"test/test_expect_test.ml":576:14: +- │ │ └─"test/test_expect_test.ml":577:16: _baz +- │ │ └─_baz = 2 +- │ ├─i = 2 +- │ ├─"test/test_expect_test.ml":576:14: +- │ │ └─"test/test_expect_test.ml":577:16: _baz +- │ │ └─_baz = 4 +- │ ├─i = 3 +- │ ├─"test/test_expect_test.ml":576:14: +- │ │ └─"test/test_expect_test.ml":577:16: _baz +- │ │ └─_baz = 6 +- │ ├─i = 4 +- │ ├─"test/test_expect_test.ml":576:14: +- │ │ └─"test/test_expect_test.ml":577:16: _baz +- │ │ └─_baz = 8 +- │ ├─i = 5 +- │ ├─"test/test_expect_test.ml":576:14: +- │ │ └─"test/test_expect_test.ml":577:16: _baz +- │ │ └─_baz = 10 +- │ ├─i = 6 +- │ └─"test/test_expect_test.ml":576:14: +- │ └─"test/test_expect_test.ml":577:16: _baz +- │ └─_baz = 12 +- └─_bar = () |}] ++ BEGIN DEBUG SESSION ++ "test/test_expect_test.ml":574:26: _bar ++ ├─"test/test_expect_test.ml":577:10: for:test_expect_test:577 ++ │ ├─i = 0 ++ │ ├─"test/test_expect_test.ml":577:14: ++ │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ │ └─_baz = 0 ++ │ ├─i = 1 ++ │ ├─"test/test_expect_test.ml":577:14: ++ │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ │ └─_baz = 2 ++ │ ├─i = 2 ++ │ ├─"test/test_expect_test.ml":577:14: ++ │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ │ └─_baz = 4 ++ │ ├─i = 3 ++ │ ├─"test/test_expect_test.ml":577:14: ++ │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ │ └─_baz = 6 ++ │ ├─i = 4 ++ │ ├─"test/test_expect_test.ml":577:14: ++ │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ │ └─_baz = 8 ++ │ ├─i = 5 ++ │ ├─"test/test_expect_test.ml":577:14: ++ │ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ │ └─_baz = 10 ++ │ ├─i = 6 ++ │ └─"test/test_expect_test.ml":577:14: ++ │ └─"test/test_expect_test.ml":578:16: _baz ++ │ └─_baz = 12 ++ └─_bar = () ++ |}] + + let%expect_test "%track_this_show track while-loop" = + let module Debug_runtime = (val Minidebug_runtime.debug ()) in +@@ -639,28 +647,28 @@ let%expect_test "%track_this_show track while-loop" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":628:26: _bar +- ├─"test/test_expect_test.ml":630:8: while:test_expect_test:630 +- │ ├─"test/test_expect_test.ml":631:10: +- │ │ └─"test/test_expect_test.ml":631:14: _baz ++ "test/test_expect_test.ml":629:26: _bar ++ ├─"test/test_expect_test.ml":631:8: while:test_expect_test:631 ++ │ ├─"test/test_expect_test.ml":632:10: ++ │ │ └─"test/test_expect_test.ml":632:14: _baz + │ │ └─_baz = 0 +- │ ├─"test/test_expect_test.ml":631:10: +- │ │ └─"test/test_expect_test.ml":631:14: _baz ++ │ ├─"test/test_expect_test.ml":632:10: ++ │ │ └─"test/test_expect_test.ml":632:14: _baz + │ │ └─_baz = 2 +- │ ├─"test/test_expect_test.ml":631:10: +- │ │ └─"test/test_expect_test.ml":631:14: _baz ++ │ ├─"test/test_expect_test.ml":632:10: ++ │ │ └─"test/test_expect_test.ml":632:14: _baz + │ │ └─_baz = 4 +- │ ├─"test/test_expect_test.ml":631:10: +- │ │ └─"test/test_expect_test.ml":631:14: _baz ++ │ ├─"test/test_expect_test.ml":632:10: ++ │ │ └─"test/test_expect_test.ml":632:14: _baz + │ │ └─_baz = 6 +- │ ├─"test/test_expect_test.ml":631:10: +- │ │ └─"test/test_expect_test.ml":631:14: _baz ++ │ ├─"test/test_expect_test.ml":632:10: ++ │ │ └─"test/test_expect_test.ml":632:14: _baz + │ │ └─_baz = 8 +- │ └─"test/test_expect_test.ml":631:10: +- │ └─"test/test_expect_test.ml":631:14: _baz ++ │ └─"test/test_expect_test.ml":632:10: ++ │ └─"test/test_expect_test.ml":632:14: _baz + │ └─_baz = 10 + └─_bar = () +- |}] ++ |}] + + let%expect_test "%debug_this_show num children exceeded nested" = + let module Debug_runtime = (val Minidebug_runtime.debug ()) in +@@ -680,43 +688,44 @@ let%expect_test "%debug_this_show num children exceeded nested" = + in + [%expect + {| +- BEGIN DEBUG SESSION +- "test/test_expect_test.ml":666:40: loop_exceeded +- ├─x = 3 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 1 +- └─"test/test_expect_test.ml":666:40: loop_exceeded +- ├─x = 2 +- ├─"test/test_expect_test.ml":673:17: z ++ BEGIN DEBUG SESSION ++ "test/test_expect_test.ml":667:40: loop_exceeded ++ ├─x = 3 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 1 ++ └─"test/test_expect_test.ml":667:40: loop_exceeded ++ ├─x = 2 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 0 ++ └─"test/test_expect_test.ml":667:40: loop_exceeded ++ ├─x = 1 ++ ├─"test/test_expect_test.ml":674:17: z + │ └─z = 0 +- └─"test/test_expect_test.ml":666:40: loop_exceeded +- ├─x = 1 +- ├─"test/test_expect_test.ml":673:17: z ++ └─"test/test_expect_test.ml":667:40: loop_exceeded ++ ├─x = 0 ++ ├─"test/test_expect_test.ml":674:17: z + │ └─z = 0 +- └─"test/test_expect_test.ml":666:40: loop_exceeded +- ├─x = 0 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 0 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 1 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 2 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 3 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 4 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 5 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 6 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 7 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 8 +- ├─"test/test_expect_test.ml":673:17: z +- │ └─z = 9 +- └─z = +- Raised exception: ppx_minidebug: max_num_children exceeded |}] ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 1 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 2 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 3 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 4 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 5 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 6 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 7 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 8 ++ ├─"test/test_expect_test.ml":674:17: z ++ │ └─z = 9 ++ └─z = ++ Raised exception: ppx_minidebug: max_num_children exceeded ++ |}] + + let%expect_test "%debug_this_show truncated children nested" = + let module Debug_runtime = (val Minidebug_runtime.debug ~truncate_children:4 ()) in +@@ -734,115 +743,116 @@ let%expect_test "%debug_this_show truncated children nested" = + in + [%expect + {| +- BEGIN DEBUG SESSION +- "test/test_expect_test.ml":722:40: loop_exceeded +- ├─ +- ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ ├─ +- │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ └─loop_exceeded = 1945 +- │ ├─"test/test_expect_test.ml":727:15: z +- │ │ └─z = 5 +- │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ └─loop_exceeded = 1945 +- │ └─loop_exceeded = 11685 +- ├─"test/test_expect_test.ml":727:15: z +- │ └─z = 5 +- ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ ├─ +- │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ └─loop_exceeded = 1945 +- │ ├─"test/test_expect_test.ml":727:15: z +- │ │ └─z = 5 +- │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ ├─ +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ └─z = 9 +- │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded +- │ │ │ ├─ +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 17 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 18 +- │ │ │ ├─"test/test_expect_test.ml":727:15: z +- │ │ │ │ └─z = 19 +- │ │ │ └─loop_exceeded = 190 +- │ │ └─loop_exceeded = 1945 +- │ └─loop_exceeded = 11685 +- └─loop_exceeded = 58435 +- 58435 |}] ++ BEGIN DEBUG SESSION ++ "test/test_expect_test.ml":723:40: loop_exceeded ++ ├─ ++ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ ├─ ++ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─ ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ └─z = 9 ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ └─loop_exceeded = 1945 ++ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ └─z = 5 ++ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─ ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ └─z = 9 ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ └─loop_exceeded = 1945 ++ │ └─loop_exceeded = 11685 ++ ├─"test/test_expect_test.ml":728:15: z ++ │ └─z = 5 ++ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ ├─ ++ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─ ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ └─z = 9 ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ └─loop_exceeded = 1945 ++ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ └─z = 5 ++ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ ├─ ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ └─z = 9 ++ │ │ ├─"test/test_expect_test.ml":723:40: loop_exceeded ++ │ │ │ ├─ ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 17 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 18 ++ │ │ │ ├─"test/test_expect_test.ml":728:15: z ++ │ │ │ │ └─z = 19 ++ │ │ │ └─loop_exceeded = 190 ++ │ │ └─loop_exceeded = 1945 ++ │ └─loop_exceeded = 11685 ++ └─loop_exceeded = 58435 ++ 58435 ++ |}] + + let%expect_test "%track_this_show highlight FIXME" = + let module Debug_runtime = +@@ -857,64 +867,65 @@ let%expect_test "%track_this_show highlight FIXME" = + print_endline @@ Int.to_string @@ loop_highlight 7; + [%expect + {| +- BEGIN DEBUG SESSION +- ┌─────────────────────────────────────────────────┐ +- │"test/test_expect_test.ml":850:41: loop_highlight│ +- ├─────────────────────────────────────────────────┘ +- ├─x = 7 +- ├─┬────────────────────────────────────┐ +- │ │"test/test_expect_test.ml":853:10: z│ +- │ ├────────────────────────────────────┘ +- │ └─┬─────┐ +- │ │z = 3│ +- │ └─────┘ +- ├─┬─────────────────────────────────────────────────┐ +- │ │"test/test_expect_test.ml":850:41: loop_highlight│ +- │ ├─────────────────────────────────────────────────┘ +- │ ├─x = 6 +- │ ├─"test/test_expect_test.ml":853:10: z +- │ │ └─z = 2 +- │ ├─┬─────────────────────────────────────────────────┐ +- │ │ │"test/test_expect_test.ml":850:41: loop_highlight│ +- │ │ ├─────────────────────────────────────────────────┘ +- │ │ ├─x = 5 +- │ │ ├─"test/test_expect_test.ml":853:10: z +- │ │ │ └─z = 2 +- │ │ ├─┬─────────────────────────────────────────────────┐ +- │ │ │ │"test/test_expect_test.ml":850:41: loop_highlight│ +- │ │ │ ├─────────────────────────────────────────────────┘ +- │ │ │ ├─x = 4 +- │ │ │ ├─"test/test_expect_test.ml":853:10: z +- │ │ │ │ └─z = 1 +- │ │ │ ├─┬─────────────────────────────────────────────────┐ +- │ │ │ │ │"test/test_expect_test.ml":850:41: loop_highlight│ +- │ │ │ │ ├─────────────────────────────────────────────────┘ +- │ │ │ │ ├─┬─────┐ +- │ │ │ │ │ │x = 3│ +- │ │ │ │ │ └─────┘ +- │ │ │ │ ├─"test/test_expect_test.ml":853:10: z +- │ │ │ │ │ └─z = 1 +- │ │ │ │ ├─"test/test_expect_test.ml":850:41: loop_highlight +- │ │ │ │ │ ├─x = 2 +- │ │ │ │ │ ├─"test/test_expect_test.ml":853:10: z +- │ │ │ │ │ │ └─z = 0 +- │ │ │ │ │ ├─"test/test_expect_test.ml":850:41: loop_highlight +- │ │ │ │ │ │ ├─x = 1 +- │ │ │ │ │ │ ├─"test/test_expect_test.ml":853:10: z +- │ │ │ │ │ │ │ └─z = 0 +- │ │ │ │ │ │ ├─"test/test_expect_test.ml":850:41: loop_highlight +- │ │ │ │ │ │ │ ├─x = 0 +- │ │ │ │ │ │ │ ├─"test/test_expect_test.ml":853:10: z +- │ │ │ │ │ │ │ │ └─z = 0 +- │ │ │ │ │ │ │ └─loop_highlight = 0 +- │ │ │ │ │ │ └─loop_highlight = 0 +- │ │ │ │ │ └─loop_highlight = 0 +- │ │ │ │ └─loop_highlight = 1 +- │ │ │ └─loop_highlight = 2 +- │ │ └─loop_highlight = 4 +- │ └─loop_highlight = 6 +- └─loop_highlight = 9 +- 9 |}] ++ BEGIN DEBUG SESSION ++ ┌─────────────────────────────────────────────────┐ ++ │"test/test_expect_test.ml":851:41: loop_highlight│ ++ ├─────────────────────────────────────────────────┘ ++ ├─x = 7 ++ ├─┬────────────────────────────────────┐ ++ │ │"test/test_expect_test.ml":854:10: z│ ++ │ ├────────────────────────────────────┘ ++ │ └─┬─────┐ ++ │ │z = 3│ ++ │ └─────┘ ++ ├─┬─────────────────────────────────────────────────┐ ++ │ │"test/test_expect_test.ml":851:41: loop_highlight│ ++ │ ├─────────────────────────────────────────────────┘ ++ │ ├─x = 6 ++ │ ├─"test/test_expect_test.ml":854:10: z ++ │ │ └─z = 2 ++ │ ├─┬─────────────────────────────────────────────────┐ ++ │ │ │"test/test_expect_test.ml":851:41: loop_highlight│ +...TRUNCATED BY DUNE... + toplevel +- ├─"test/test_expect_test.ml":3149:17 ++ ├─"test/test_expect_test.ml":3151:17 + ├─("for bar, b-3", 42) + └─("for baz, f squared", 64) + |}] +@@ -3196,11 +3278,11 @@ let%expect_test "%diagn_show ignores non-empty bindings" = + {| + BEGIN DEBUG SESSION + bar +- ├─"test/test_expect_test.ml":3178:21 ++ ├─"test/test_expect_test.ml":3180:21 + └─("for bar, b-3", 42) + 336 + baz +- ├─"test/test_expect_test.ml":3185:21 ++ ├─"test/test_expect_test.ml":3187:21 + └─("foo baz, f squared", 49) + 91 + |}] +@@ -3219,9 +3301,14 @@ let%expect_test "%diagn_show no logs FIXME" = + in + let () = print_endline @@ Int.to_string @@ baz { first = 7; second = 42 } in + [%expect {| +- BEGIN DEBUG SESSION +- 336 +- 91 |}] ++ BEGIN DEBUG SESSION ++ bar ++ └─"test/test_expect_test.ml":3210:21 ++ 336 ++ baz ++ └─"test/test_expect_test.ml":3216:21 ++ 91 ++ |}] + + let%expect_test "%debug_show log level TODO" = + let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in +@@ -3248,21 +3335,25 @@ let%expect_test "%debug_show log level TODO" = + 336 + 109 + () +- ├─"test/test_expect_test.ml":3226:17 ++ ├─"test/test_expect_test.ml":3228:17 + ├─bar = 336 +- │ ├─"test/test_expect_test.ml":3229:14 ++ │ ├─"test/test_expect_test.ml":3231:14 ++ │ ├─first = 7 ++ │ ├─second = 42 + │ ├─{first=a; second=b} +- │ │ ├─"test/test_expect_test.ml":3230:12 ++ │ │ ├─"test/test_expect_test.ml":3232:12 + │ │ └─ + │ │ ├─a = 7 + │ │ └─b = 45 + │ ├─y = 8 +- │ │ └─"test/test_expect_test.ml":3231:12 ++ │ │ └─"test/test_expect_test.ml":3233:12 + │ └─("for bar, b-3", 42) + └─baz = 109 +- ├─"test/test_expect_test.ml":3235:14 ++ ├─"test/test_expect_test.ml":3237:14 ++ ├─first = 7 ++ ├─second = 42 + ├─{first; second} +- │ ├─"test/test_expect_test.ml":3236:12 ++ │ ├─"test/test_expect_test.ml":3238:12 + │ └─ + │ ├─first = 8 + │ └─second = 45 +@@ -3296,12 +3387,28 @@ let%expect_test "%debug_show log level TODO compile+runtime" = + 336 + 109 + () +- ├─"test/test_expect_test.ml":3300:17 ++ ├─"test/test_expect_test.ml":3276:17 + ├─bar = 336 +- │ ├─"test/test_expect_test.ml":3303:14 ++ │ ├─"test/test_expect_test.ml":3279:14 ++ │ ├─first = 7 ++ │ ├─second = 42 ++ │ ├─{first=a; second=b} ++ │ │ ├─"test/test_expect_test.ml":3280:12 ++ │ │ └─ ++ │ │ ├─a = 7 ++ │ │ └─b = 45 ++ │ ├─y = 8 ++ │ │ └─"test/test_expect_test.ml":3281:12 + │ └─("for bar, b-3", 42) + └─baz = 109 +- ├─"test/test_expect_test.ml":3309:14 ++ ├─"test/test_expect_test.ml":3285:14 ++ ├─first = 7 ++ ├─second = 42 ++ ├─{first; second} ++ │ ├─"test/test_expect_test.ml":3286:12 ++ │ └─ ++ │ ├─first = 8 ++ │ └─second = 45 + └─("for baz, f squared", 64) + |}] + +@@ -3317,75 +3424,75 @@ let%expect_test "%debug_this_show PrintBox snapshot" = + {| + BEGIN DEBUG SESSION + loop_highlight +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 7 + └─z = 3 +- └─"test/test_expect_test.ml":3335:8 ++ └─"test/test_expect_test.ml":3311:8 + +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 7 + ├─z = 3 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 6 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 5 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 4 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 3 + └─z = 1 +- └─"test/test_expect_test.ml":3335:8 ++ └─"test/test_expect_test.ml":3311:8 + +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 7 + ├─z = 3 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 6 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 6 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 4 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 5 + ├─z = 2 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 2 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 4 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 1 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 3 + ├─z = 1 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 2 + ├─z = 0 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 1 + ├─z = 0 +- │ └─"test/test_expect_test.ml":3335:8 ++ │ └─"test/test_expect_test.ml":3311:8 + └─loop_highlight = 0 +- ├─"test/test_expect_test.ml":3334:41 ++ ├─"test/test_expect_test.ml":3310:41 + ├─x = 0 + └─z = 0 +- └─"test/test_expect_test.ml":3335:8 ++ └─"test/test_expect_test.ml":3311:8 + 9 + |}] + +@@ -3427,7 +3534,7 @@ let%expect_test "%log_printbox" = + {| + BEGIN DEBUG SESSION + foo = () +- ├─"test/test_expect_test.ml":3435:21 ++ ├─"test/test_expect_test.ml":3410:21 + ├─0/0│0/1│0/2│0/3│0/4 + │ ───┼───┼───┼───┼─── + │ 1/0│1/1│1/2│1/3│1/4 +@@ -3492,7 +3599,7 @@ let%expect_test "%log_printbox flushing" = + [%expect + {| + BEGIN DEBUG SESSION +- foo begin "test/test_expect_test.ml":3497:21: ++ foo begin "test/test_expect_test.ml":3472:21: + 0/0│0/1│0/2│0/3│0/4 + ───┼───┼───┼───┼─── + 1/0│1/1│1/2│1/3│1/4 +@@ -3517,7 +3624,7 @@ let%expect_test "%log_printbox flushing" = + + + 4/0 4/1 4/2 4/3 4/4 +- bar begin "test/test_expect_test.ml":3506:12: ++ bar begin "test/test_expect_test.ml":3481:12: + "Now with a frame:" + ┌───┬───┬───┬───┬───┐ + │0/0│0/1│0/2│0/3│0/4│ +@@ -3577,7 +3684,7 @@ let%expect_test "%log_entry" = + [%expect + {| + BEGIN DEBUG SESSION +- "test/test_expect_test.ml":3566:17: _logging_logic ++ "test/test_expect_test.ml":3541:17: _logging_logic + ├─"preamble" + ├─header 1 + │ ├─"log 1" +@@ -3617,36 +3724,36 @@ let%expect_test "flame graph" = + print_endline output; + [%expect + {| +-
++
+-
++
+-
++
+-
++
+-
++
+- +
+-
++
+-
++
+- +
+-
++
+-
++
+-
++
+-
++
+- +
+-
++
+-
++
+-
++
+- +@@ -3721,31 +3828,31 @@ let%expect_test "flame graph reduced ToC" = + print_endline output; + [%expect + {| +-
++
+-
++
+-
++
+-
++
+-
++ +
+-
++
+- +
+-
++
+-
++
+-
++
+-
++ +
+-
++
+-
++
+- +@@ -3803,10 +3910,10 @@ let%expect_test "%debug_show skip module bindings" = + {| + BEGIN DEBUG SESSION + bar = 15 +- ├─"test/test_expect_test.ml":3816:21 ++ ├─"test/test_expect_test.ml":3791:21 + ├─x = 7 + └─y = 8 +- └─"test/test_expect_test.ml":3818:8 ++ └─"test/test_expect_test.ml":3793:8 + 15 + |}] + +@@ -3832,52 +3939,52 @@ let%expect_test "%track_l_show procedure runtime passing" = + [%expect + {| + BEGIN DEBUG SESSION foo-1 +- foo-1 foo begin "test/test_expect_test.ml":3843:28: ++ foo-1 foo begin "test/test_expect_test.ml":3818:28: + "inside foo" + foo-1 foo end + + BEGIN DEBUG SESSION foo-1 +- foo-1 () begin "test/test_expect_test.ml":3849:8: ++ foo-1 () begin "test/test_expect_test.ml":3824:8: + "inside bar" + foo-1 () end + + BEGIN DEBUG SESSION foo-2 +- foo-2 foo begin "test/test_expect_test.ml":3843:28: ++ foo-2 foo begin "test/test_expect_test.ml":3818:28: + "inside foo" + foo-2 foo end + + BEGIN DEBUG SESSION foo-2 +- foo-2 () begin "test/test_expect_test.ml":3849:8: ++ foo-2 () begin "test/test_expect_test.ml":3824:8: + "inside bar" + foo-2 () end + + BEGIN DEBUG SESSION foo-3 +- foo-3 foo begin "test/test_expect_test.ml":3843:28: ++ foo-3 foo begin "test/test_expect_test.ml":3818:28: + "inside foo" + foo-3 foo end + + BEGIN DEBUG SESSION foo-3 +- foo-3 () begin "test/test_expect_test.ml":3849:8: ++ foo-3 () begin "test/test_expect_test.ml":3824:8: + "inside bar" + foo-3 () end + + BEGIN DEBUG SESSION foo-4 +- foo-4 foo begin "test/test_expect_test.ml":3843:28: ++ foo-4 foo begin "test/test_expect_test.ml":3818:28: + "inside foo" + foo-4 foo end + + BEGIN DEBUG SESSION foo-4 +- foo-4 () begin "test/test_expect_test.ml":3849:8: ++ foo-4 () begin "test/test_expect_test.ml":3824:8: + "inside bar" + foo-4 () end + + BEGIN DEBUG SESSION foo-5 +- foo-5 foo begin "test/test_expect_test.ml":3843:28: ++ foo-5 foo begin "test/test_expect_test.ml":3818:28: + "inside foo" + foo-5 foo end + + BEGIN DEBUG SESSION foo-5 +- foo-5 () begin "test/test_expect_test.ml":3849:8: ++ foo-5 () begin "test/test_expect_test.ml":3824:8: + "inside bar" + foo-5 () end + |}] +@@ -3937,18 +4044,18 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + ┌─────────┐ + │bar = 336│ + ├─────────┘ +- ├─"test/test_expect_test.ml":3946:21 ++ ├─"test/test_expect_test.ml":3921:21 + ├─first = 7 + ├─second = 42 + └─┬─────┐ + │y = 8│ + ├─────┘ +- └─"test/test_expect_test.ml":3947:8 ++ └─"test/test_expect_test.ml":3922:8 + 336 + ┌────────┐ + │(r1, r2)│ + ├────────┘ +- ├─"test/test_expect_test.ml":3956:6 ++ ├─"test/test_expect_test.ml":3931:6 + ├─┬─────────┐ + │ ││ + │ ├─────────┘ +@@ -3959,13 +4066,13 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + └─┬────────────────┐ + │baz = (339, 109)│ + ├────────────────┘ +- ├─"test/test_expect_test.ml":3951:10 ++ ├─"test/test_expect_test.ml":3926:10 + ├─first = 7 + ├─second = 42 + ├─┬──────┐ + │ │(y, z)│ + │ ├──────┘ +- │ ├─"test/test_expect_test.ml":3952:8 ++ │ ├─"test/test_expect_test.ml":3927:8 + │ └─┬────────┐ + │ ││ + │ ├────────┘ +@@ -3976,7 +4083,7 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = + └─┬──────┐ + │(a, b)│ + ├──────┘ +- ├─"test/test_expect_test.ml":3953:8 ++ ├─"test/test_expect_test.ml":3928:8 + └─┬────────┐ + ││ + ├────────┘ +9 +File "test/debugger_show_log_prefixed.expected.log", line 1, characters 0-0: +diff --git a/_build/default/test/debugger_show_log_prefixed.expected.log b/_build/default/test/debugger_show_log_prefixed.log +index b425bed..043518c 100644 +--- a/_build/default/test/debugger_show_log_prefixed.expected.log ++++ b/_build/default/test/debugger_show_log_prefixed.log +@@ -1,21 +1,21 @@ + + BEGIN DEBUG SESSION + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 7) ++ ("inside loop", 7) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 6) ++ ("inside loop", 6) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 5) ++ ("inside loop", 5) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 4) ++ ("inside loop", 4) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 3) ++ ("inside loop", 3) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 2) ++ ("inside loop", 2) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 1) ++ ("inside loop", 1) + loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: +- ("INFO: inside loop", 0) ++ ("inside loop", 0) + loop_exceeded end + loop_exceeded end + loop_exceeded end +@@ -24,40 +24,85 @@ loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: + loop_exceeded end + loop_exceeded end + loop_exceeded end +-bar begin "test/test_debug_log_prefixed.ml":17:19: +- for:test_debug_log_prefixed:18 begin "test/test_debug_log_prefixed.ml":18:2: +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 0, "value", 0) ++bar begin "test/test_debug_log_prefixed.ml":18:19: ++ for:test_debug_log_prefixed:19 begin "test/test_debug_log_prefixed.ml":19:2: ++ i = 0 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 0 ++ _baz end ++ ("loop step", 0, "value", 0) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 1, "value", 2) ++ i = 1 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 2 ++ _baz end ++ ("loop step", 1, "value", 2) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 2, "value", 4) ++ i = 2 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 4 ++ _baz end ++ ("loop step", 2, "value", 4) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 3, "value", 6) ++ i = 3 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 6 ++ _baz end ++ ("loop step", 3, "value", 6) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 4, "value", 8) ++ i = 4 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 8 ++ _baz end ++ ("loop step", 4, "value", 8) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 5, "value", 10) ++ i = 5 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 10 ++ _baz end ++ ("loop step", 5, "value", 10) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 6, "value", 12) ++ i = 6 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 12 ++ _baz end ++ ("loop step", 6, "value", 12) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 7, "value", 14) ++ i = 7 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 14 ++ _baz end ++ ("loop step", 7, "value", 14) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 8, "value", 16) ++ i = 8 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 16 ++ _baz end ++ ("loop step", 8, "value", 16) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 9, "value", 18) ++ i = 9 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 18 ++ _baz end ++ ("loop step", 9, "value", 18) + end +- begin "test/test_debug_log_prefixed.ml":18:6: +- ("INFO: loop step", 10, "value", 20) ++ i = 10 ++ begin "test/test_debug_log_prefixed.ml":19:6: ++ _baz begin "test/test_debug_log_prefixed.ml":20:8: ++ _baz = 20 ++ _baz end ++ ("loop step", 10, "value", 20) + end +- for:test_debug_log_prefixed:18 end ++ for:test_debug_log_prefixed:19 end ++ bar = () + bar end diff --git a/test/debugger_show_log_prefixed.expected.log b/test/debugger_show_log_prefixed.expected.log index b425bed..043518c 100644 --- a/test/debugger_show_log_prefixed.expected.log +++ b/test/debugger_show_log_prefixed.expected.log @@ -1,21 +1,21 @@ BEGIN DEBUG SESSION loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 7) + ("inside loop", 7) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 6) + ("inside loop", 6) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 5) + ("inside loop", 5) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 4) + ("inside loop", 4) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 3) + ("inside loop", 3) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 2) + ("inside loop", 2) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 1) + ("inside loop", 1) loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: - ("INFO: inside loop", 0) + ("inside loop", 0) loop_exceeded end loop_exceeded end loop_exceeded end @@ -24,40 +24,85 @@ loop_exceeded begin "test/test_debug_log_prefixed.ml":6:33: loop_exceeded end loop_exceeded end loop_exceeded end -bar begin "test/test_debug_log_prefixed.ml":17:19: - for:test_debug_log_prefixed:18 begin "test/test_debug_log_prefixed.ml":18:2: - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 0, "value", 0) +bar begin "test/test_debug_log_prefixed.ml":18:19: + for:test_debug_log_prefixed:19 begin "test/test_debug_log_prefixed.ml":19:2: + i = 0 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 0 + _baz end + ("loop step", 0, "value", 0) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 1, "value", 2) + i = 1 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 2 + _baz end + ("loop step", 1, "value", 2) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 2, "value", 4) + i = 2 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 4 + _baz end + ("loop step", 2, "value", 4) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 3, "value", 6) + i = 3 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 6 + _baz end + ("loop step", 3, "value", 6) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 4, "value", 8) + i = 4 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 8 + _baz end + ("loop step", 4, "value", 8) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 5, "value", 10) + i = 5 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 10 + _baz end + ("loop step", 5, "value", 10) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 6, "value", 12) + i = 6 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 12 + _baz end + ("loop step", 6, "value", 12) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 7, "value", 14) + i = 7 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 14 + _baz end + ("loop step", 7, "value", 14) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 8, "value", 16) + i = 8 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 16 + _baz end + ("loop step", 8, "value", 16) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 9, "value", 18) + i = 9 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 18 + _baz end + ("loop step", 9, "value", 18) end - begin "test/test_debug_log_prefixed.ml":18:6: - ("INFO: loop step", 10, "value", 20) + i = 10 + begin "test/test_debug_log_prefixed.ml":19:6: + _baz begin "test/test_debug_log_prefixed.ml":20:8: + _baz = 20 + _baz end + ("loop step", 10, "value", 20) end - for:test_debug_log_prefixed:18 end + for:test_debug_log_prefixed:19 end + bar = () bar end diff --git a/test/dune b/test/dune index 1b32cf4..92a7a0b 100644 --- a/test/dune +++ b/test/dune @@ -76,7 +76,7 @@ (action (setenv PPX_MINIDEBUG_TEST_LOG_LEVEL_CONSISTENCY - everything + 9 (run ./%{pp} --impl %{input} -o %{targets})))) (rule diff --git a/test/test_debug_interrupts.expected.ml b/test/test_debug_interrupts.expected.ml index 25faa57..eb1c9bb 100644 --- a/test/test_debug_interrupts.expected.ml +++ b/test/test_debug_interrupts.expected.ml @@ -9,18 +9,20 @@ let rec loop_exceeded (x : int) = if Debug_runtime.exceeds_max_children () then (Debug_runtime.log_value_show ~descr:"loop_exceeded" - ~entry_id:__entry_id ~is_result:false ""; + ~entry_id:__entry_id ~log_level:1 ~is_result:false + ""; failwith "ppx_minidebug: max_num_children exceeded") else ((Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:7 ~start_colnum:33 ~end_lnum:9 ~end_colnum:55 - ~message:"loop_exceeded : int" ~entry_id:__entry_id; + ~message:"loop_exceeded : int" ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_show ?descr:(Some "x : int") - ~entry_id:__entry_id ~is_result:false (([%show : int]) x)); + ~entry_id:__entry_id ~log_level:1 ~is_result:false + (([%show : int]) x)); if Debug_runtime.exceeds_max_nesting () then (Debug_runtime.log_value_show ~descr:"loop_exceeded" - ~entry_id:__entry_id ~is_result:false + ~entry_id:__entry_id ~log_level:1 ~is_result:false ""; Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" ~start_lnum:7 ~entry_id:__entry_id; @@ -32,17 +34,17 @@ let rec loop_exceeded (x : int) = if Debug_runtime.exceeds_max_children () then (Debug_runtime.log_value_show ~descr:"z" - ~entry_id:__entry_id ~is_result:false + ~entry_id:__entry_id ~log_level:1 ~is_result:false ""; failwith "ppx_minidebug: max_num_children exceeded") else (Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:8 ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 - ~message:"z" ~entry_id:__entry_id; + ~message:"z" ~entry_id:__entry_id ~log_level:1; if Debug_runtime.exceeds_max_nesting () then (Debug_runtime.log_value_show ~descr:"z" - ~entry_id:__entry_id ~is_result:false + ~entry_id:__entry_id ~log_level:1 ~is_result:false ""; Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" ~start_lnum:8 @@ -54,7 +56,8 @@ let rec loop_exceeded (x : int) = (((); Debug_runtime.log_value_show ?descr:(Some "z : int") ~entry_id:__entry_id - ~is_result:true (([%show : int]) z)); + ~log_level:1 ~is_result:true + (([%show : int]) z)); Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" ~start_lnum:8 ~entry_id:__entry_id; @@ -69,7 +72,7 @@ let rec loop_exceeded (x : int) = | __res -> (Debug_runtime.log_value_show ?descr:(Some "loop_exceeded : int") ~entry_id:__entry_id - ~is_result:true (([%show : int]) __res); + ~log_level:1 ~is_result:true (([%show : int]) __res); Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" ~start_lnum:7 ~entry_id:__entry_id; __res) @@ -86,16 +89,16 @@ let bar () = if Debug_runtime.exceeds_max_children () then (Debug_runtime.log_value_show ~descr:"bar" ~entry_id:__entry_id - ~is_result:false ""; + ~log_level:1 ~is_result:false ""; failwith "ppx_minidebug: max_num_children exceeded") else (Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:15 ~start_colnum:19 ~end_lnum:19 ~end_colnum:6 ~message:"bar : unit" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; if Debug_runtime.exceeds_max_nesting () then (Debug_runtime.log_value_show ~descr:"bar" ~entry_id:__entry_id - ~is_result:false ""; + ~log_level:1 ~is_result:false ""; Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" ~start_lnum:15 ~entry_id:__entry_id; failwith "ppx_minidebug: max_nesting_depth exceeded") @@ -103,28 +106,31 @@ let bar () = (match let __entry_id = Debug_runtime.get_entry_id () in Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:16 ~start_colnum:2 ~end_lnum:19 ~end_colnum:6 - ~message:"for:test_debug_interrupts:16" ~entry_id:__entry_id; + ~message:"for:test_debug_interrupts:16" ~entry_id:__entry_id + ~log_level:1; (match for i = 0 to 100 do let __entry_id = Debug_runtime.get_entry_id () in Debug_runtime.log_value_show ?descr:(Some "i : int") - ~entry_id:__entry_id ~is_result:false + ~entry_id:__entry_id ~log_level:1 ~is_result:false (([%show : int]) i); if Debug_runtime.exceeds_max_children () then (Debug_runtime.log_value_show ~descr:"i" - ~entry_id:__entry_id ~is_result:false - ""; + ~entry_id:__entry_id ~log_level:1 + ~is_result:false ""; failwith "ppx_minidebug: max_num_children exceeded") else (Debug_runtime.open_log ~fname:"test_debug_interrupts.ml" ~start_lnum:16 ~start_colnum:6 ~end_lnum:16 ~end_colnum:7 - ~message:"" ~entry_id:__entry_id; + ~message:"" ~entry_id:__entry_id + ~log_level:1; if Debug_runtime.exceeds_max_nesting () then (Debug_runtime.log_value_show ~descr:"i" - ~entry_id:__entry_id ~is_result:false + ~entry_id:__entry_id ~log_level:1 + ~is_result:false ""; Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" @@ -141,7 +147,7 @@ let bar () = then (Debug_runtime.log_value_show ~descr:"_baz" ~entry_id:__entry_id - ~is_result:false + ~log_level:1 ~is_result:false ""; failwith "ppx_minidebug: max_num_children exceeded") @@ -151,7 +157,7 @@ let bar () = ~start_lnum:17 ~start_colnum:8 ~end_lnum:17 ~end_colnum:12 ~message:"_baz" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; if Debug_runtime.exceeds_max_nesting () @@ -159,7 +165,7 @@ let bar () = (Debug_runtime.log_value_show ~descr:"_baz" ~entry_id:__entry_id - ~is_result:false + ~log_level:1 ~is_result:false ""; Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" @@ -174,6 +180,7 @@ let bar () = Debug_runtime.log_value_show ?descr:(Some "_baz : int") ~entry_id:__entry_id + ~log_level:1 ~is_result:true (([%show : int]) _baz)); Debug_runtime.close_log @@ -213,7 +220,8 @@ let bar () = with | __res -> (Debug_runtime.log_value_show ?descr:(Some "bar : unit") - ~entry_id:__entry_id ~is_result:true (([%show : unit]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : unit]) __res); Debug_runtime.close_log ~fname:"test_debug_interrupts.ml" ~start_lnum:15 ~entry_id:__entry_id; __res) diff --git a/test/test_debug_log_level_consistency.expected.ml b/test/test_debug_log_level_consistency.expected.ml index b50465a..43e8ebe 100644 --- a/test/test_debug_log_level_consistency.expected.ml +++ b/test/test_debug_log_level_consistency.expected.ml @@ -6,12 +6,12 @@ module Debug_runtime = (val (Stdlib.Sys.getenv "PPX_MINIDEBUG_TEST_LOG_LEVEL_CONSISTENCY") in if (not (Stdlib.String.equal "" runtime_log_level)) && - (not (Stdlib.String.equal "everything" runtime_log_level)) + (not (Stdlib.String.equal "9" runtime_log_level)) then failwith ("ppx_minidebug: compile-time vs. runtime log level mismatch, found '" ^ - ("everything" ^ + ("9" ^ ("' at compile time, '" ^ (runtime_log_level ^ "' at runtime")))) with | Stdlib.Not_found -> () let foo (x : int) = @@ -19,21 +19,22 @@ let foo (x : int) = (); (Debug_runtime.open_log ~fname:"test_debug_log_level_consistency.ml" ~start_lnum:7 ~start_colnum:19 ~end_lnum:9 ~end_colnum:17 - ~message:"foo" ~entry_id:__entry_id; + ~message:"foo" ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%show : int]) x)); + ~log_level:1 ~is_result:false (([%show : int]) x)); (match let y : int = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_log_level_consistency.ml" ~start_lnum:8 ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x + 1 with | y as __res -> (((); Debug_runtime.log_value_show ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true (([%show : int]) y)); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) y)); Debug_runtime.close_log ~fname:"test_debug_log_level_consistency.ml" ~start_lnum:8 ~entry_id:__entry_id; @@ -47,7 +48,8 @@ let foo (x : int) = with | __res -> (Debug_runtime.log_value_show ?descr:(Some "foo") - ~entry_id:__entry_id ~is_result:true (([%show : int list]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int list]) __res); Debug_runtime.close_log ~fname:"test_debug_log_level_consistency.ml" ~start_lnum:7 ~entry_id:__entry_id; __res) diff --git a/test/test_debug_log_nothing.ml b/test/test_debug_log_nothing.ml index b97462a..544e5f6 100644 --- a/test/test_debug_log_nothing.ml +++ b/test/test_debug_log_nothing.ml @@ -1,7 +1,7 @@ module Debug_runtime = (val Minidebug_runtime.debug_flushing ~filename:"debugger_show_log_nothing" ()) -[%%global_debug_log_level Nothing] +[%%global_debug_log_level 0] let%debug_show rec loop_exceeded (x : int) : int = let z : int = diff --git a/test/test_debug_log_prefixed.expected.ml b/test/test_debug_log_prefixed.expected.ml index b747c8b..7f6b789 100644 --- a/test/test_debug_log_prefixed.expected.ml +++ b/test/test_debug_log_prefixed.expected.ml @@ -5,13 +5,14 @@ let rec loop_exceeded (x : int) = (let __entry_id = Debug_runtime.get_entry_id () in (); (Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:6 - ~start_colnum:33 ~end_lnum:11 ~end_colnum:55 ~message:"loop_exceeded" - ~entry_id:__entry_id; + ~start_colnum:33 ~end_lnum:12 ~end_colnum:55 ~message:"loop_exceeded" + ~entry_id:__entry_id ~log_level:1; ()); (match let z : int = Debug_runtime.log_value_show ?descr:None ~entry_id:__entry_id - ~is_result:false - (([%show : (string * int)]) ("INFO: inside loop", (x : int))); + ~log_level:2 ~is_result:false + (([%show : (string * int)]) ("inside loop", (x : int))); + (); (x - 1) / 2 in if x <= 0 then 0 else z + (loop_exceeded (z + (x / 2))) with @@ -30,54 +31,85 @@ let () = let bar () = (let __entry_id = Debug_runtime.get_entry_id () in (); - Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:17 - ~start_colnum:19 ~end_lnum:21 ~end_colnum:6 ~message:"bar" - ~entry_id:__entry_id; + Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:18 + ~start_colnum:19 ~end_lnum:23 ~end_colnum:6 ~message:"bar" + ~entry_id:__entry_id ~log_level:1; (match let __entry_id = Debug_runtime.get_entry_id () in Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" - ~start_lnum:18 ~start_colnum:2 ~end_lnum:21 ~end_colnum:6 - ~message:"for:test_debug_log_prefixed:18" ~entry_id:__entry_id; + ~start_lnum:19 ~start_colnum:2 ~end_lnum:23 ~end_colnum:6 + ~message:"for:test_debug_log_prefixed:19" ~entry_id:__entry_id + ~log_level:1; (match for i = 0 to 10 do let __entry_id = Debug_runtime.get_entry_id () in - (); + Debug_runtime.log_value_show ?descr:(Some "i") + ~entry_id:__entry_id ~log_level:1 ~is_result:false + (([%show : int]) i); Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" - ~start_lnum:18 ~start_colnum:6 ~end_lnum:18 - ~end_colnum:7 ~message:"" ~entry_id:__entry_id; - (match let _baz : int = i * 2 in + ~start_lnum:19 ~start_colnum:6 ~end_lnum:19 + ~end_colnum:7 ~message:"" ~entry_id:__entry_id + ~log_level:1; + (match let _baz : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log + ~fname:"test_debug_log_prefixed.ml" + ~start_lnum:20 ~start_colnum:8 ~end_lnum:20 + ~end_colnum:12 ~message:"_baz" + ~entry_id:__entry_id ~log_level:1; + (match i * 2 with + | _baz as __res -> + (((); + Debug_runtime.log_value_show + ?descr:(Some "_baz") + ~entry_id:__entry_id ~log_level:1 + ~is_result:true (([%show : int]) _baz)); + Debug_runtime.close_log + ~fname:"test_debug_log_prefixed.ml" + ~start_lnum:20 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log + ~fname:"test_debug_log_prefixed.ml" + ~start_lnum:20 ~entry_id:__entry_id; + raise e)) in Debug_runtime.log_value_show ?descr:None - ~entry_id:__entry_id ~is_result:false + ~entry_id:__entry_id ~log_level:2 + ~is_result:false (([%show : (string * int * string * int)]) - ("INFO: loop step", (i : int), "value", - (_baz : int))) + ("loop step", (i : int), "value", + (_baz : int))); + () with | () -> ((); Debug_runtime.close_log - ~fname:"test_debug_log_prefixed.ml" ~start_lnum:19 + ~fname:"test_debug_log_prefixed.ml" ~start_lnum:20 ~entry_id:__entry_id; ()) | exception e -> (Debug_runtime.close_log - ~fname:"test_debug_log_prefixed.ml" ~start_lnum:19 + ~fname:"test_debug_log_prefixed.ml" ~start_lnum:20 ~entry_id:__entry_id; raise e)) done with | () -> Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" - ~start_lnum:18 ~entry_id:__entry_id + ~start_lnum:19 ~entry_id:__entry_id | exception e -> (Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" - ~start_lnum:18 ~entry_id:__entry_id; + ~start_lnum:19 ~entry_id:__entry_id; raise e)) with | __res -> - ((); + (Debug_runtime.log_value_show ?descr:(Some "bar") + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : unit]) __res); Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" - ~start_lnum:17 ~entry_id:__entry_id; + ~start_lnum:18 ~entry_id:__entry_id; __res) | exception e -> (Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml" - ~start_lnum:17 ~entry_id:__entry_id; + ~start_lnum:18 ~entry_id:__entry_id; raise e)) : unit) let () = try bar () with | _ -> print_endline "Raised exception." diff --git a/test/test_debug_log_prefixed.ml b/test/test_debug_log_prefixed.ml index 6f6f874..e76f96d 100644 --- a/test/test_debug_log_prefixed.ml +++ b/test/test_debug_log_prefixed.ml @@ -1,11 +1,12 @@ module Debug_runtime = (val Minidebug_runtime.debug_flushing ~filename:"debugger_show_log_prefixed" ()) -[%%global_debug_log_level Prefixed [| "INFO" |]] +[%%global_debug_log_level 2] -let%debug_show rec loop_exceeded (x : int) : int = +let%diagn_show rec loop_exceeded (x : int) : int = let z : int = - [%log "INFO: inside loop", (x : int)]; + [%log2 "inside loop", (x : int)]; + [%log3 "this is detail"]; (x - 1) / 2 in if x <= 0 then 0 else z + loop_exceeded (z + (x / 2)) @@ -17,7 +18,8 @@ let () = let%track_show bar () : unit = for i = 0 to 10 do let _baz : int = i * 2 in - [%log "INFO: loop step", (i : int), "value", (_baz : int)] + [%log2 "loop step", (i : int), "value", (_baz : int)]; + [%log3 "this is detail"] done let () = try bar () with _ -> print_endline "Raised exception." diff --git a/test/test_debug_pp.expected.ml b/test/test_debug_pp.expected.ml index be68a7e..d0f1d29 100644 --- a/test/test_debug_pp.expected.ml +++ b/test/test_debug_pp.expected.ml @@ -9,20 +9,21 @@ let bar (x : t) = (); (Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:7 ~start_colnum:17 ~end_lnum:9 ~end_colnum:14 ~message:"bar" - ~entry_id:__entry_id; - Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp - ~is_result:false x); + ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id + ~log_level:1 ~pp ~is_result:false x); (match let y : num = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:8 ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x.first + 1 with | y as __res -> (((); Debug_runtime.log_value_pp ?descr:(Some "y") - ~entry_id:__entry_id ~pp:pp_num ~is_result:true y); + ~entry_id:__entry_id ~log_level:1 ~pp:pp_num + ~is_result:true y); Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:8 ~entry_id:__entry_id; __res) @@ -34,7 +35,7 @@ let bar (x : t) = with | __res -> (Debug_runtime.log_value_pp ?descr:(Some "bar") ~entry_id:__entry_id - ~pp:pp_num ~is_result:true __res; + ~log_level:1 ~pp:pp_num ~is_result:true __res; Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:7 ~entry_id:__entry_id; __res) @@ -48,20 +49,21 @@ let baz (x : t) = (); (Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:13 ~start_colnum:17 ~end_lnum:15 ~end_colnum:20 ~message:"baz" - ~entry_id:__entry_id; - Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp - ~is_result:false x); + ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id + ~log_level:1 ~pp ~is_result:false x); (match let (({ first = y; second = z } as _yz) : t) = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:14 ~start_colnum:36 ~end_lnum:14 ~end_colnum:39 ~message:"_yz" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match { first = (x.first + 1); second = 3 } with | _yz as __res -> (((); Debug_runtime.log_value_pp ?descr:(Some "_yz") - ~entry_id:__entry_id ~pp ~is_result:true _yz); + ~entry_id:__entry_id ~log_level:1 ~pp ~is_result:true + _yz); Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:14 ~entry_id:__entry_id; __res) @@ -73,7 +75,7 @@ let baz (x : t) = with | __res -> (Debug_runtime.log_value_pp ?descr:(Some "baz") ~entry_id:__entry_id - ~pp:pp_num ~is_result:true __res; + ~log_level:1 ~pp:pp_num ~is_result:true __res; Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:13 ~entry_id:__entry_id; __res) @@ -87,11 +89,11 @@ let rec loop (depth : num) (x : t) = (); ((Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:19 ~start_colnum:22 ~end_lnum:25 ~end_colnum:9 ~message:"loop" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_pp ?descr:(Some "depth") ~entry_id:__entry_id - ~pp:pp_num ~is_result:false depth); - Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp - ~is_result:false x); + ~log_level:1 ~pp:pp_num ~is_result:false depth); + Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id + ~log_level:1 ~pp ~is_result:false x); (match if depth > 6 then x.first + x.second else @@ -105,14 +107,15 @@ let rec loop (depth : num) (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:23 ~start_colnum:8 ~end_lnum:23 ~end_colnum:9 - ~message:"y" ~entry_id:__entry_id; + ~message:"y" ~entry_id:__entry_id ~log_level:1; (match loop (depth + 1) { first = (x.second - 1); second = (x.first + 2) } with | y as __res -> (((); Debug_runtime.log_value_pp ?descr:(Some "y") - ~entry_id:__entry_id ~pp:pp_num ~is_result:true y); + ~entry_id:__entry_id ~log_level:1 ~pp:pp_num + ~is_result:true y); Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:23 ~entry_id:__entry_id; __res) @@ -125,14 +128,15 @@ let rec loop (depth : num) (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_pp.ml" ~start_lnum:24 ~start_colnum:8 ~end_lnum:24 ~end_colnum:9 - ~message:"z" ~entry_id:__entry_id; + ~message:"z" ~entry_id:__entry_id ~log_level:1; (match loop (depth + 1) { first = (x.second + 1); second = y } with | z as __res -> (((); Debug_runtime.log_value_pp ?descr:(Some "z") - ~entry_id:__entry_id ~pp:pp_num ~is_result:true z); + ~entry_id:__entry_id ~log_level:1 ~pp:pp_num + ~is_result:true z); Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:24 ~entry_id:__entry_id; __res) @@ -144,7 +148,7 @@ let rec loop (depth : num) (x : t) = with | __res -> (Debug_runtime.log_value_pp ?descr:(Some "loop") ~entry_id:__entry_id - ~pp:pp_num ~is_result:true __res; + ~log_level:1 ~pp:pp_num ~is_result:true __res; Debug_runtime.close_log ~fname:"test_debug_pp.ml" ~start_lnum:19 ~entry_id:__entry_id; __res) diff --git a/test/test_debug_sexp.expected.ml b/test/test_debug_sexp.expected.ml index c06f791..f1d2fdc 100644 --- a/test/test_debug_sexp.expected.ml +++ b/test/test_debug_sexp.expected.ml @@ -6,20 +6,20 @@ let foo (x : int) = (); (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:7 ~start_colnum:19 ~end_lnum:9 ~end_colnum:17 ~message:"foo" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%sexp_of : int]) x)); + ~log_level:1 ~is_result:false (([%sexp_of : int]) x)); (match let y : int = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:8 ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x + 1 with | y as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int]) y)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:8 ~entry_id:__entry_id; @@ -32,7 +32,7 @@ let foo (x : int) = with | __res -> (Debug_runtime.log_value_sexp ?descr:(Some "foo") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int list]) __res); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:7 ~entry_id:__entry_id; @@ -50,20 +50,20 @@ let bar (x : t) = (); (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:15 ~start_colnum:19 ~end_lnum:17 ~end_colnum:14 ~message:"bar" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%sexp_of : t]) x)); + ~log_level:1 ~is_result:false (([%sexp_of : t]) x)); (match let y : int = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:16 ~start_colnum:6 ~end_lnum:16 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x.first + 1 with | y as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int]) y)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:16 ~entry_id:__entry_id; @@ -76,7 +76,8 @@ let bar (x : t) = with | __res -> (Debug_runtime.log_value_sexp ?descr:(Some "bar") - ~entry_id:__entry_id ~is_result:true (([%sexp_of : int]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) __res); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:15 ~entry_id:__entry_id; __res) @@ -90,20 +91,20 @@ let baz (x : t) = (); (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:21 ~start_colnum:19 ~end_lnum:24 ~end_colnum:28 ~message:"baz" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%sexp_of : t]) x)); + ~log_level:1 ~is_result:false (([%sexp_of : t]) x)); (match let (((y, z) as _yz) : (int * int)) = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:22 ~start_colnum:17 ~end_lnum:22 ~end_colnum:20 ~message:"_yz" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match ((x.first + 1), 3) with | _yz as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "_yz") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : (int * int)]) _yz)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:22 ~entry_id:__entry_id; @@ -117,12 +118,12 @@ let baz (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:23 ~start_colnum:17 ~end_lnum:23 ~end_colnum:20 ~message:"_uw" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match (7, 13) with | _uw as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "_uw") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : (int * int)]) _uw)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:23 ~entry_id:__entry_id; @@ -135,7 +136,8 @@ let baz (x : t) = with | __res -> (Debug_runtime.log_value_sexp ?descr:(Some "baz") - ~entry_id:__entry_id ~is_result:true (([%sexp_of : int]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) __res); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:21 ~entry_id:__entry_id; __res) @@ -149,20 +151,20 @@ let lab ~x:(x : int) = (); (Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:28 ~start_colnum:19 ~end_lnum:30 ~end_colnum:17 ~message:"lab" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%sexp_of : int]) x)); + ~log_level:1 ~is_result:false (([%sexp_of : int]) x)); (match let y : int = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:29 ~start_colnum:6 ~end_lnum:29 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x + 1 with | y as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int]) y)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:29 ~entry_id:__entry_id; @@ -175,7 +177,7 @@ let lab ~x:(x : int) = with | __res -> (Debug_runtime.log_value_sexp ?descr:(Some "lab") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int list]) __res); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:28 ~entry_id:__entry_id; @@ -190,11 +192,11 @@ let rec loop (depth : int) (x : t) = (); ((Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:34 ~start_colnum:24 ~end_lnum:40 ~end_colnum:9 ~message:"loop" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_sexp ?descr:(Some "depth") ~entry_id:__entry_id - ~is_result:false (([%sexp_of : int]) depth)); + ~log_level:1 ~is_result:false (([%sexp_of : int]) depth)); Debug_runtime.log_value_sexp ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%sexp_of : t]) x)); + ~log_level:1 ~is_result:false (([%sexp_of : t]) x)); (match if depth > 4 then x.first + x.second else @@ -208,14 +210,14 @@ let rec loop (depth : int) (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:38 ~start_colnum:8 ~end_lnum:38 ~end_colnum:9 - ~message:"y" ~entry_id:__entry_id; + ~message:"y" ~entry_id:__entry_id ~log_level:1; (match loop (depth + 1) { first = (x.second - 1); second = (x.first + 2) } with | y as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int]) y)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:38 ~entry_id:__entry_id; @@ -229,14 +231,14 @@ let rec loop (depth : int) (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_sexp.ml" ~start_lnum:39 ~start_colnum:8 ~end_lnum:39 ~end_colnum:9 - ~message:"z" ~entry_id:__entry_id; + ~message:"z" ~entry_id:__entry_id ~log_level:1; (match loop (depth + 1) { first = (x.second + 1); second = y } with | z as __res -> (((); Debug_runtime.log_value_sexp ?descr:(Some "z") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%sexp_of : int]) z)); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:39 ~entry_id:__entry_id; @@ -249,7 +251,8 @@ let rec loop (depth : int) (x : t) = with | __res -> (Debug_runtime.log_value_sexp ?descr:(Some "loop") - ~entry_id:__entry_id ~is_result:true (([%sexp_of : int]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%sexp_of : int]) __res); Debug_runtime.close_log ~fname:"test_debug_sexp.ml" ~start_lnum:34 ~entry_id:__entry_id; __res) diff --git a/test/test_debug_show.expected.ml b/test/test_debug_show.expected.ml index a2d0f07..b2c6499 100644 --- a/test/test_debug_show.expected.ml +++ b/test/test_debug_show.expected.ml @@ -5,20 +5,21 @@ let foo (x : int) = (); (Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:4 ~start_colnum:19 ~end_lnum:6 ~end_colnum:17 ~message:"foo" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%show : int]) x)); + ~log_level:1 ~is_result:false (([%show : int]) x)); (match let y : int = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:5 ~start_colnum:6 ~end_lnum:5 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x + 1 with | y as __res -> (((); Debug_runtime.log_value_show ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true (([%show : int]) y)); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) y)); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:5 ~entry_id:__entry_id; __res) @@ -30,7 +31,8 @@ let foo (x : int) = with | __res -> (Debug_runtime.log_value_show ?descr:(Some "foo") - ~entry_id:__entry_id ~is_result:true (([%show : int list]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int list]) __res); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:4 ~entry_id:__entry_id; __res) @@ -47,20 +49,21 @@ let bar (x : t) = (); (Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:12 ~start_colnum:19 ~end_lnum:14 ~end_colnum:14 ~message:"bar" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%show : t]) x)); + ~log_level:1 ~is_result:false (([%show : t]) x)); (match let y : int = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:13 ~start_colnum:6 ~end_lnum:13 ~end_colnum:7 ~message:"y" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match x.first + 1 with | y as __res -> (((); Debug_runtime.log_value_show ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true (([%show : int]) y)); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) y)); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:13 ~entry_id:__entry_id; __res) @@ -72,7 +75,8 @@ let bar (x : t) = with | __res -> (Debug_runtime.log_value_show ?descr:(Some "bar") - ~entry_id:__entry_id ~is_result:true (([%show : int]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) __res); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:12 ~entry_id:__entry_id; __res) @@ -86,20 +90,20 @@ let baz (x : t) = (); (Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:18 ~start_colnum:19 ~end_lnum:20 ~end_colnum:20 ~message:"baz" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%show : t]) x)); + ~log_level:1 ~is_result:false (([%show : t]) x)); (match let (((y, z) as _yz) : (int * int)) = let __entry_id = Debug_runtime.get_entry_id () in (); Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:19 ~start_colnum:17 ~end_lnum:19 ~end_colnum:20 ~message:"_yz" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; (match ((x.first + 1), 3) with | _yz as __res -> (((); Debug_runtime.log_value_show ?descr:(Some "_yz") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%show : (int * int)]) _yz)); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:19 ~entry_id:__entry_id; @@ -112,7 +116,8 @@ let baz (x : t) = with | __res -> (Debug_runtime.log_value_show ?descr:(Some "baz") - ~entry_id:__entry_id ~is_result:true (([%show : int]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) __res); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:18 ~entry_id:__entry_id; __res) @@ -126,11 +131,11 @@ let rec loop (depth : int) (x : t) = (); ((Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:24 ~start_colnum:24 ~end_lnum:30 ~end_colnum:9 ~message:"loop" - ~entry_id:__entry_id; + ~entry_id:__entry_id ~log_level:1; Debug_runtime.log_value_show ?descr:(Some "depth") ~entry_id:__entry_id - ~is_result:false (([%show : int]) depth)); + ~log_level:1 ~is_result:false (([%show : int]) depth)); Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id - ~is_result:false (([%show : t]) x)); + ~log_level:1 ~is_result:false (([%show : t]) x)); (match if depth > 6 then x.first + x.second else @@ -144,14 +149,14 @@ let rec loop (depth : int) (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:28 ~start_colnum:8 ~end_lnum:28 ~end_colnum:9 - ~message:"y" ~entry_id:__entry_id; + ~message:"y" ~entry_id:__entry_id ~log_level:1; (match loop (depth + 1) { first = (x.second - 1); second = (x.first + 2) } with | y as __res -> (((); Debug_runtime.log_value_show ?descr:(Some "y") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%show : int]) y)); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:28 ~entry_id:__entry_id; @@ -165,14 +170,14 @@ let rec loop (depth : int) (x : t) = (); Debug_runtime.open_log ~fname:"test_debug_show.ml" ~start_lnum:29 ~start_colnum:8 ~end_lnum:29 ~end_colnum:9 - ~message:"z" ~entry_id:__entry_id; + ~message:"z" ~entry_id:__entry_id ~log_level:1; (match loop (depth + 1) { first = (x.second + 1); second = y } with | z as __res -> (((); Debug_runtime.log_value_show ?descr:(Some "z") - ~entry_id:__entry_id ~is_result:true + ~entry_id:__entry_id ~log_level:1 ~is_result:true (([%show : int]) z)); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:29 ~entry_id:__entry_id; @@ -185,7 +190,8 @@ let rec loop (depth : int) (x : t) = with | __res -> (Debug_runtime.log_value_show ?descr:(Some "loop") - ~entry_id:__entry_id ~is_result:true (([%show : int]) __res); + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (([%show : int]) __res); Debug_runtime.close_log ~fname:"test_debug_show.ml" ~start_lnum:24 ~entry_id:__entry_id; __res) diff --git a/test/test_debug_unannot_bindings.expected.ml b/test/test_debug_unannot_bindings.expected.ml index 2a0cf69..224d767 100644 --- a/test/test_debug_unannot_bindings.expected.ml +++ b/test/test_debug_unannot_bindings.expected.ml @@ -5,7 +5,7 @@ let _result = (); Debug_runtime.open_log ~fname:"test_debug_unannot_bindings.ml" ~start_lnum:4 ~start_colnum:15 ~end_lnum:4 ~end_colnum:22 - ~message:"_result" ~entry_id:__entry_id; + ~message:"_result" ~entry_id:__entry_id ~log_level:1; (match let a = 1 in let b = 2 in let point = (a, b) in ignore point with | _ as __res -> ((); diff --git a/test/test_expect_test.ml b/test/test_expect_test.ml index cdc20a4..caff578 100644 --- a/test/test_expect_test.ml +++ b/test/test_expect_test.ml @@ -22,7 +22,7 @@ let%expect_test "%debug_this_show flushing to a file" = print_endline @@ Int.to_string @@ loop 0 { first = 7; second = 42 }; [%expect {| 56 |}] -let%expect_test "%debug_show flushing to stdout" = +let%expect_test "%debug_show flushing to stdout FIXME double-check indentation" = let module Debug_runtime = (val Minidebug_runtime.debug_flushing ~time_tagged:Clock ()) in let%debug_show bar (x : t) : int = @@ -239,7 +239,8 @@ let%expect_test "%debug_this_show disabled subtree" = 9 |}]; let%debug_this_show rec loop_changes (x : int) : int = let z : int = (x - 1) / 2 in - (* The call [x = 2] is not printed because it is a descendant of the no-debug call [x = 4]. *) + (* The call [x = 2] is not printed because it is a descendant of the no-debug call [x + = 4]. *) Debug_runtime.no_debug_if (x <> 6 && x <> 2 && (z + 1) * 2 = x); if x <= 0 then 0 else z + loop_changes (z + (x / 2)) in @@ -277,39 +278,40 @@ let%expect_test "%debug_this_show with exception" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":268:41: loop_truncated + "test/test_expect_test.ml":269:41: loop_truncated ├─x = 7 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 3 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 6 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 2 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 5 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 2 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 4 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 1 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 3 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 1 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 2 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 0 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 1 - ├─"test/test_expect_test.ml":269:8: z + ├─"test/test_expect_test.ml":270:8: z │ └─z = 0 - └─"test/test_expect_test.ml":268:41: loop_truncated + └─"test/test_expect_test.ml":269:41: loop_truncated ├─x = 0 - └─"test/test_expect_test.ml":269:8: z + └─"test/test_expect_test.ml":270:8: z └─z = 0 - Raised exception. |}] + Raised exception. + |}] let%expect_test "%debug_this_show depth exceeded" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -325,28 +327,29 @@ let%expect_test "%debug_this_show depth exceeded" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":316:40: loop_exceeded - ├─x = 7 - ├─"test/test_expect_test.ml":319:10: z - │ └─z = 3 - └─"test/test_expect_test.ml":316:40: loop_exceeded - ├─x = 6 - ├─"test/test_expect_test.ml":319:10: z + BEGIN DEBUG SESSION + "test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 7 + ├─"test/test_expect_test.ml":321:10: z + │ └─z = 3 + └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 6 + ├─"test/test_expect_test.ml":321:10: z + │ └─z = 2 + └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 5 + ├─"test/test_expect_test.ml":321:10: z │ └─z = 2 - └─"test/test_expect_test.ml":316:40: loop_exceeded - ├─x = 5 - ├─"test/test_expect_test.ml":319:10: z - │ └─z = 2 - └─"test/test_expect_test.ml":316:40: loop_exceeded - ├─x = 4 - ├─"test/test_expect_test.ml":319:10: z - │ └─z = 1 - └─"test/test_expect_test.ml":316:40: loop_exceeded - ├─x = 3 - └─"test/test_expect_test.ml":319:10: z - └─z = - Raised exception. |}] + └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 4 + ├─"test/test_expect_test.ml":321:10: z + │ └─z = 1 + └─"test/test_expect_test.ml":318:40: loop_exceeded + ├─x = 3 + └─"test/test_expect_test.ml":321:10: z + └─z = + Raised exception. + |}] let%expect_test "%debug_this_show num children exceeded linear" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -366,31 +369,32 @@ let%expect_test "%debug_this_show num children exceeded linear" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":355:26: _bar - ├─"test/test_expect_test.ml":359:16: _baz + "test/test_expect_test.ml":358:26: _bar + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 0 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 2 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 4 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 6 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 8 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 10 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 12 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 14 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 16 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 18 - ├─"test/test_expect_test.ml":359:16: _baz + ├─"test/test_expect_test.ml":362:16: _baz │ └─_baz = 20 └─_baz = - Raised exception: ppx_minidebug: max_num_children exceeded |}] + Raised exception: ppx_minidebug: max_num_children exceeded + |}] let%expect_test "%debug_this_show truncated children linear" = let module Debug_runtime = (val Minidebug_runtime.debug ~truncate_children:10 ()) in @@ -408,27 +412,28 @@ let%expect_test "%debug_this_show truncated children linear" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":399:26: _bar + "test/test_expect_test.ml":403:26: _bar ├─ - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 44 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 46 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 48 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 50 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 52 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 54 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 56 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 58 - ├─"test/test_expect_test.ml":401:14: _baz + ├─"test/test_expect_test.ml":405:14: _baz │ └─_baz = 60 - └─_bar = () |}] + └─_bar = () + |}] let%expect_test "%track_this_show track for-loop num children exceeded" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -448,31 +453,32 @@ let%expect_test "%track_this_show track for-loop num children exceeded" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":437:26: _bar - └─"test/test_expect_test.ml":440:10: for:test_expect_test:440 + "test/test_expect_test.ml":442:26: _bar + └─"test/test_expect_test.ml":445:10: for:test_expect_test:445 ├─i = 0 - ├─"test/test_expect_test.ml":440:14: - │ └─"test/test_expect_test.ml":441:16: _baz + ├─"test/test_expect_test.ml":445:14: + │ └─"test/test_expect_test.ml":446:16: _baz │ └─_baz = 0 ├─i = 1 - ├─"test/test_expect_test.ml":440:14: - │ └─"test/test_expect_test.ml":441:16: _baz + ├─"test/test_expect_test.ml":445:14: + │ └─"test/test_expect_test.ml":446:16: _baz │ └─_baz = 2 ├─i = 2 - ├─"test/test_expect_test.ml":440:14: - │ └─"test/test_expect_test.ml":441:16: _baz + ├─"test/test_expect_test.ml":445:14: + │ └─"test/test_expect_test.ml":446:16: _baz │ └─_baz = 4 ├─i = 3 - ├─"test/test_expect_test.ml":440:14: - │ └─"test/test_expect_test.ml":441:16: _baz + ├─"test/test_expect_test.ml":445:14: + │ └─"test/test_expect_test.ml":446:16: _baz │ └─_baz = 6 ├─i = 4 - ├─"test/test_expect_test.ml":440:14: - │ └─"test/test_expect_test.ml":441:16: _baz + ├─"test/test_expect_test.ml":445:14: + │ └─"test/test_expect_test.ml":446:16: _baz │ └─_baz = 8 ├─i = 5 └─i = - Raised exception: ppx_minidebug: max_num_children exceeded |}] + Raised exception: ppx_minidebug: max_num_children exceeded + |}] let%expect_test "%track_this_show track for-loop truncated children" = let module Debug_runtime = (val Minidebug_runtime.debug ~truncate_children:10 ()) in @@ -490,30 +496,31 @@ let%expect_test "%track_this_show track for-loop truncated children" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":481:26: _bar - ├─"test/test_expect_test.ml":482:8: for:test_expect_test:482 + "test/test_expect_test.ml":487:26: _bar + ├─"test/test_expect_test.ml":488:8: for:test_expect_test:488 │ ├─ │ ├─i = 26 - │ ├─"test/test_expect_test.ml":482:12: - │ │ └─"test/test_expect_test.ml":483:14: _baz + │ ├─"test/test_expect_test.ml":488:12: + │ │ └─"test/test_expect_test.ml":489:14: _baz │ │ └─_baz = 52 │ ├─i = 27 - │ ├─"test/test_expect_test.ml":482:12: - │ │ └─"test/test_expect_test.ml":483:14: _baz + │ ├─"test/test_expect_test.ml":488:12: + │ │ └─"test/test_expect_test.ml":489:14: _baz │ │ └─_baz = 54 │ ├─i = 28 - │ ├─"test/test_expect_test.ml":482:12: - │ │ └─"test/test_expect_test.ml":483:14: _baz + │ ├─"test/test_expect_test.ml":488:12: + │ │ └─"test/test_expect_test.ml":489:14: _baz │ │ └─_baz = 56 │ ├─i = 29 - │ ├─"test/test_expect_test.ml":482:12: - │ │ └─"test/test_expect_test.ml":483:14: _baz + │ ├─"test/test_expect_test.ml":488:12: + │ │ └─"test/test_expect_test.ml":489:14: _baz │ │ └─_baz = 58 │ ├─i = 30 - │ └─"test/test_expect_test.ml":482:12: - │ └─"test/test_expect_test.ml":483:14: _baz + │ └─"test/test_expect_test.ml":488:12: + │ └─"test/test_expect_test.ml":489:14: _baz │ └─_baz = 60 - └─_bar = () |}] + └─_bar = () + |}] let%expect_test "%track_this_show track for-loop" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -532,38 +539,39 @@ let%expect_test "%track_this_show track for-loop" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":522:26: _bar - ├─"test/test_expect_test.ml":525:10: for:test_expect_test:525 - │ ├─i = 0 - │ ├─"test/test_expect_test.ml":525:14: - │ │ └─"test/test_expect_test.ml":526:16: _baz - │ │ └─_baz = 0 - │ ├─i = 1 - │ ├─"test/test_expect_test.ml":525:14: - │ │ └─"test/test_expect_test.ml":526:16: _baz - │ │ └─_baz = 2 - │ ├─i = 2 - │ ├─"test/test_expect_test.ml":525:14: - │ │ └─"test/test_expect_test.ml":526:16: _baz - │ │ └─_baz = 4 - │ ├─i = 3 - │ ├─"test/test_expect_test.ml":525:14: - │ │ └─"test/test_expect_test.ml":526:16: _baz - │ │ └─_baz = 6 - │ ├─i = 4 - │ ├─"test/test_expect_test.ml":525:14: - │ │ └─"test/test_expect_test.ml":526:16: _baz - │ │ └─_baz = 8 - │ ├─i = 5 - │ ├─"test/test_expect_test.ml":525:14: - │ │ └─"test/test_expect_test.ml":526:16: _baz - │ │ └─_baz = 10 - │ ├─i = 6 - │ └─"test/test_expect_test.ml":525:14: - │ └─"test/test_expect_test.ml":526:16: _baz - │ └─_baz = 12 - └─_bar = () |}] + BEGIN DEBUG SESSION + "test/test_expect_test.ml":529:26: _bar + ├─"test/test_expect_test.ml":532:10: for:test_expect_test:532 + │ ├─i = 0 + │ ├─"test/test_expect_test.ml":532:14: + │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 0 + │ ├─i = 1 + │ ├─"test/test_expect_test.ml":532:14: + │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 2 + │ ├─i = 2 + │ ├─"test/test_expect_test.ml":532:14: + │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 4 + │ ├─i = 3 + │ ├─"test/test_expect_test.ml":532:14: + │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 6 + │ ├─i = 4 + │ ├─"test/test_expect_test.ml":532:14: + │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 8 + │ ├─i = 5 + │ ├─"test/test_expect_test.ml":532:14: + │ │ └─"test/test_expect_test.ml":533:16: _baz + │ │ └─_baz = 10 + │ ├─i = 6 + │ └─"test/test_expect_test.ml":532:14: + │ └─"test/test_expect_test.ml":533:16: _baz + │ └─_baz = 12 + └─_bar = () + |}] let%expect_test "%track_this_show track for-loop, time spans" = let module Debug_runtime = (val Minidebug_runtime.debug ~elapsed_times:Microseconds ()) @@ -588,38 +596,39 @@ let%expect_test "%track_this_show track for-loop, time spans" = print_endline output; [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":573:26: _bar - ├─"test/test_expect_test.ml":576:10: for:test_expect_test:576 - │ ├─i = 0 - │ ├─"test/test_expect_test.ml":576:14: - │ │ └─"test/test_expect_test.ml":577:16: _baz - │ │ └─_baz = 0 - │ ├─i = 1 - │ ├─"test/test_expect_test.ml":576:14: - │ │ └─"test/test_expect_test.ml":577:16: _baz - │ │ └─_baz = 2 - │ ├─i = 2 - │ ├─"test/test_expect_test.ml":576:14: - │ │ └─"test/test_expect_test.ml":577:16: _baz - │ │ └─_baz = 4 - │ ├─i = 3 - │ ├─"test/test_expect_test.ml":576:14: - │ │ └─"test/test_expect_test.ml":577:16: _baz - │ │ └─_baz = 6 - │ ├─i = 4 - │ ├─"test/test_expect_test.ml":576:14: - │ │ └─"test/test_expect_test.ml":577:16: _baz - │ │ └─_baz = 8 - │ ├─i = 5 - │ ├─"test/test_expect_test.ml":576:14: - │ │ └─"test/test_expect_test.ml":577:16: _baz - │ │ └─_baz = 10 - │ ├─i = 6 - │ └─"test/test_expect_test.ml":576:14: - │ └─"test/test_expect_test.ml":577:16: _baz - │ └─_baz = 12 - └─_bar = () |}] + BEGIN DEBUG SESSION + "test/test_expect_test.ml":581:26: _bar + ├─"test/test_expect_test.ml":584:10: for:test_expect_test:584 + │ ├─i = 0 + │ ├─"test/test_expect_test.ml":584:14: + │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 0 + │ ├─i = 1 + │ ├─"test/test_expect_test.ml":584:14: + │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 2 + │ ├─i = 2 + │ ├─"test/test_expect_test.ml":584:14: + │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 4 + │ ├─i = 3 + │ ├─"test/test_expect_test.ml":584:14: + │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 6 + │ ├─i = 4 + │ ├─"test/test_expect_test.ml":584:14: + │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 8 + │ ├─i = 5 + │ ├─"test/test_expect_test.ml":584:14: + │ │ └─"test/test_expect_test.ml":585:16: _baz + │ │ └─_baz = 10 + │ ├─i = 6 + │ └─"test/test_expect_test.ml":584:14: + │ └─"test/test_expect_test.ml":585:16: _baz + │ └─_baz = 12 + └─_bar = () + |}] let%expect_test "%track_this_show track while-loop" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -638,28 +647,28 @@ let%expect_test "%track_this_show track while-loop" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":628:26: _bar - ├─"test/test_expect_test.ml":630:8: while:test_expect_test:630 - │ ├─"test/test_expect_test.ml":631:10: - │ │ └─"test/test_expect_test.ml":631:14: _baz + "test/test_expect_test.ml":637:26: _bar + ├─"test/test_expect_test.ml":639:8: while:test_expect_test:639 + │ ├─"test/test_expect_test.ml":640:10: + │ │ └─"test/test_expect_test.ml":640:14: _baz │ │ └─_baz = 0 - │ ├─"test/test_expect_test.ml":631:10: - │ │ └─"test/test_expect_test.ml":631:14: _baz + │ ├─"test/test_expect_test.ml":640:10: + │ │ └─"test/test_expect_test.ml":640:14: _baz │ │ └─_baz = 2 - │ ├─"test/test_expect_test.ml":631:10: - │ │ └─"test/test_expect_test.ml":631:14: _baz + │ ├─"test/test_expect_test.ml":640:10: + │ │ └─"test/test_expect_test.ml":640:14: _baz │ │ └─_baz = 4 - │ ├─"test/test_expect_test.ml":631:10: - │ │ └─"test/test_expect_test.ml":631:14: _baz + │ ├─"test/test_expect_test.ml":640:10: + │ │ └─"test/test_expect_test.ml":640:14: _baz │ │ └─_baz = 6 - │ ├─"test/test_expect_test.ml":631:10: - │ │ └─"test/test_expect_test.ml":631:14: _baz + │ ├─"test/test_expect_test.ml":640:10: + │ │ └─"test/test_expect_test.ml":640:14: _baz │ │ └─_baz = 8 - │ └─"test/test_expect_test.ml":631:10: - │ └─"test/test_expect_test.ml":631:14: _baz + │ └─"test/test_expect_test.ml":640:10: + │ └─"test/test_expect_test.ml":640:14: _baz │ └─_baz = 10 └─_bar = () - |}] + |}] let%expect_test "%debug_this_show num children exceeded nested" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -679,43 +688,44 @@ let%expect_test "%debug_this_show num children exceeded nested" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":666:40: loop_exceeded - ├─x = 3 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 1 - └─"test/test_expect_test.ml":666:40: loop_exceeded - ├─x = 2 - ├─"test/test_expect_test.ml":673:17: z + BEGIN DEBUG SESSION + "test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 3 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 1 + └─"test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 2 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 0 + └─"test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 1 + ├─"test/test_expect_test.ml":682:17: z │ └─z = 0 - └─"test/test_expect_test.ml":666:40: loop_exceeded - ├─x = 1 - ├─"test/test_expect_test.ml":673:17: z + └─"test/test_expect_test.ml":675:40: loop_exceeded + ├─x = 0 + ├─"test/test_expect_test.ml":682:17: z │ └─z = 0 - └─"test/test_expect_test.ml":666:40: loop_exceeded - ├─x = 0 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 0 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 1 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 2 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 3 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 4 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 5 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 6 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 7 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 8 - ├─"test/test_expect_test.ml":673:17: z - │ └─z = 9 - └─z = - Raised exception: ppx_minidebug: max_num_children exceeded |}] + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 1 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 2 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 3 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 4 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 5 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 6 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 7 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 8 + ├─"test/test_expect_test.ml":682:17: z + │ └─z = 9 + └─z = + Raised exception: ppx_minidebug: max_num_children exceeded + |}] let%expect_test "%debug_this_show truncated children nested" = let module Debug_runtime = (val Minidebug_runtime.debug ~truncate_children:4 ()) in @@ -733,117 +743,118 @@ let%expect_test "%debug_this_show truncated children nested" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":722:40: loop_exceeded - ├─ - ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ ├─ - │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ ├─ - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ └─z = 9 - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ └─loop_exceeded = 1945 - │ ├─"test/test_expect_test.ml":727:15: z - │ │ └─z = 5 - │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ ├─ - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ └─z = 9 - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ └─loop_exceeded = 1945 - │ └─loop_exceeded = 11685 - ├─"test/test_expect_test.ml":727:15: z - │ └─z = 5 - ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ ├─ - │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ ├─ - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ └─z = 9 - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ └─loop_exceeded = 1945 - │ ├─"test/test_expect_test.ml":727:15: z - │ │ └─z = 5 - │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ ├─ - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ └─z = 9 - │ │ ├─"test/test_expect_test.ml":722:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 17 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 18 - │ │ │ ├─"test/test_expect_test.ml":727:15: z - │ │ │ │ └─z = 19 - │ │ │ └─loop_exceeded = 190 - │ │ └─loop_exceeded = 1945 - │ └─loop_exceeded = 11685 - └─loop_exceeded = 58435 - 58435 |}] - -let%expect_test "%track_this_show highlight" = + BEGIN DEBUG SESSION + "test/test_expect_test.ml":732:40: loop_exceeded + ├─ + ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ ├─ + │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 + │ ├─"test/test_expect_test.ml":737:15: z + │ │ └─z = 5 + │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 + │ └─loop_exceeded = 11685 + ├─"test/test_expect_test.ml":737:15: z + │ └─z = 5 + ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ ├─ + │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 + │ ├─"test/test_expect_test.ml":737:15: z + │ │ └─z = 5 + │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ ├─ + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ └─z = 9 + │ │ ├─"test/test_expect_test.ml":732:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 17 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 18 + │ │ │ ├─"test/test_expect_test.ml":737:15: z + │ │ │ │ └─z = 19 + │ │ │ └─loop_exceeded = 190 + │ │ └─loop_exceeded = 1945 + │ └─loop_exceeded = 11685 + └─loop_exceeded = 58435 + 58435 + |}] + +let%expect_test "%track_this_show highlight FIXME" = let module Debug_runtime = (val Minidebug_runtime.debug ~highlight_terms:(Re.str "3") ()) in @@ -856,64 +867,65 @@ let%expect_test "%track_this_show highlight" = print_endline @@ Int.to_string @@ loop_highlight 7; [%expect {| - BEGIN DEBUG SESSION - ┌─────────────────────────────────────────────────┐ - │"test/test_expect_test.ml":850:41: loop_highlight│ - ├─────────────────────────────────────────────────┘ - ├─x = 7 - ├─┬────────────────────────────────────┐ - │ │"test/test_expect_test.ml":853:10: z│ - │ ├────────────────────────────────────┘ - │ └─┬─────┐ - │ │z = 3│ - │ └─────┘ - ├─┬─────────────────────────────────────────────────┐ - │ │"test/test_expect_test.ml":850:41: loop_highlight│ - │ ├─────────────────────────────────────────────────┘ - │ ├─x = 6 - │ ├─"test/test_expect_test.ml":853:10: z - │ │ └─z = 2 - │ ├─┬─────────────────────────────────────────────────┐ - │ │ │"test/test_expect_test.ml":850:41: loop_highlight│ - │ │ ├─────────────────────────────────────────────────┘ - │ │ ├─x = 5 - │ │ ├─"test/test_expect_test.ml":853:10: z - │ │ │ └─z = 2 - │ │ ├─┬─────────────────────────────────────────────────┐ - │ │ │ │"test/test_expect_test.ml":850:41: loop_highlight│ - │ │ │ ├─────────────────────────────────────────────────┘ - │ │ │ ├─x = 4 - │ │ │ ├─"test/test_expect_test.ml":853:10: z - │ │ │ │ └─z = 1 - │ │ │ ├─┬─────────────────────────────────────────────────┐ - │ │ │ │ │"test/test_expect_test.ml":850:41: loop_highlight│ - │ │ │ │ ├─────────────────────────────────────────────────┘ - │ │ │ │ ├─┬─────┐ - │ │ │ │ │ │x = 3│ - │ │ │ │ │ └─────┘ - │ │ │ │ ├─"test/test_expect_test.ml":853:10: z - │ │ │ │ │ └─z = 1 - │ │ │ │ ├─"test/test_expect_test.ml":850:41: loop_highlight - │ │ │ │ │ ├─x = 2 - │ │ │ │ │ ├─"test/test_expect_test.ml":853:10: z - │ │ │ │ │ │ └─z = 0 - │ │ │ │ │ ├─"test/test_expect_test.ml":850:41: loop_highlight - │ │ │ │ │ │ ├─x = 1 - │ │ │ │ │ │ ├─"test/test_expect_test.ml":853:10: z - │ │ │ │ │ │ │ └─z = 0 - │ │ │ │ │ │ ├─"test/test_expect_test.ml":850:41: loop_highlight - │ │ │ │ │ │ │ ├─x = 0 - │ │ │ │ │ │ │ ├─"test/test_expect_test.ml":853:10: z - │ │ │ │ │ │ │ │ └─z = 0 - │ │ │ │ │ │ │ └─loop_highlight = 0 - │ │ │ │ │ │ └─loop_highlight = 0 - │ │ │ │ │ └─loop_highlight = 0 - │ │ │ │ └─loop_highlight = 1 - │ │ │ └─loop_highlight = 2 - │ │ └─loop_highlight = 4 - │ └─loop_highlight = 6 - └─loop_highlight = 9 - 9 |}] + BEGIN DEBUG SESSION + ┌─────────────────────────────────────────────────┐ + │"test/test_expect_test.ml":861:41: loop_highlight│ + ├─────────────────────────────────────────────────┘ + ├─x = 7 + ├─┬────────────────────────────────────┐ + │ │"test/test_expect_test.ml":864:10: z│ + │ ├────────────────────────────────────┘ + │ └─┬─────┐ + │ │z = 3│ + │ └─────┘ + ├─┬─────────────────────────────────────────────────┐ + │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ ├─────────────────────────────────────────────────┘ + │ ├─x = 6 + │ ├─"test/test_expect_test.ml":864:10: z + │ │ └─z = 2 + │ ├─┬─────────────────────────────────────────────────┐ + │ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ │ ├─────────────────────────────────────────────────┘ + │ │ ├─x = 5 + │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ └─z = 2 + │ │ ├─┬─────────────────────────────────────────────────┐ + │ │ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ │ │ ├─────────────────────────────────────────────────┘ + │ │ │ ├─x = 4 + │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ └─z = 1 + │ │ │ ├─┬─────────────────────────────────────────────────┐ + │ │ │ │ │"test/test_expect_test.ml":861:41: loop_highlight│ + │ │ │ │ ├─────────────────────────────────────────────────┘ + │ │ │ │ ├─┬─────┐ + │ │ │ │ │ │x = 3│ + │ │ │ │ │ └─────┘ + │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ └─z = 1 + │ │ │ │ ├─"test/test_expect_test.ml":861:41: loop_highlight + │ │ │ │ │ ├─x = 2 + │ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ │ └─z = 0 + │ │ │ │ │ ├─"test/test_expect_test.ml":861:41: loop_highlight + │ │ │ │ │ │ ├─x = 1 + │ │ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ │ │ └─z = 0 + │ │ │ │ │ │ ├─"test/test_expect_test.ml":861:41: loop_highlight + │ │ │ │ │ │ │ ├─x = 0 + │ │ │ │ │ │ │ ├─"test/test_expect_test.ml":864:10: z + │ │ │ │ │ │ │ │ └─z = 0 + │ │ │ │ │ │ │ └─loop_highlight = 0 + │ │ │ │ │ │ └─loop_highlight = 0 + │ │ │ │ │ └─loop_highlight = 0 + │ │ │ │ └─loop_highlight = 1 + │ │ │ └─loop_highlight = 2 + │ │ └─loop_highlight = 4 + │ └─loop_highlight = 6 + └─loop_highlight = 9 + 9 + |}] let%expect_test "%track_this_show PrintBox tracking" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -929,19 +941,19 @@ let%expect_test "%track_this_show PrintBox tracking" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":920:37: track_branches - ├─x = 7 - ├─"test/test_expect_test.ml":922:9: else:test_expect_test:922 - │ └─"test/test_expect_test.ml":922:36: - └─track_branches = 4 - 4 - "test/test_expect_test.ml":920:37: track_branches - ├─x = 3 - ├─"test/test_expect_test.ml":921:18: then:test_expect_test:921 - │ └─"test/test_expect_test.ml":921:54: - └─track_branches = -3 - -3 + BEGIN DEBUG SESSION + "test/test_expect_test.ml":932:37: track_branches + ├─x = 7 + ├─"test/test_expect_test.ml":934:9: else:test_expect_test:934 + │ └─"test/test_expect_test.ml":934:36: + └─track_branches = 4 + 4 + "test/test_expect_test.ml":932:37: track_branches + ├─x = 3 + ├─"test/test_expect_test.ml":933:18: then:test_expect_test:933 + │ └─"test/test_expect_test.ml":933:54: + └─track_branches = -3 + -3 |}] let%expect_test "%track_this_show PrintBox tracking " = @@ -962,11 +974,11 @@ let%expect_test "%track_this_show PrintBox tracking " = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":953:11: - 4 - "test/test_expect_test.ml":955:11: x - -3 + BEGIN DEBUG SESSION + "test/test_expect_test.ml":965:11: + 4 + "test/test_expect_test.ml":967:11: x + -3 |}] let%expect_test "%track_this_show PrintBox tracking with debug_notrace" = @@ -995,23 +1007,23 @@ let%expect_test "%track_this_show PrintBox tracking with debug_notrace" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":974:37: track_branches - ├─x = 8 - ├─"test/test_expect_test.ml":983:6: else:test_expect_test:983 - │ └─"test/test_expect_test.ml":987:10: - │ └─"test/test_expect_test.ml":987:14: result - │ ├─"test/test_expect_test.ml":987:44: then:test_expect_test:987 - │ └─result = 8 - └─track_branches = 8 - 8 - "test/test_expect_test.ml":974:37: track_branches - ├─x = 3 - ├─"test/test_expect_test.ml":976:6: then:test_expect_test:976 - │ └─"test/test_expect_test.ml":980:14: result - │ └─result = 3 - └─track_branches = 3 - 3 + BEGIN DEBUG SESSION + "test/test_expect_test.ml":986:37: track_branches + ├─x = 8 + ├─"test/test_expect_test.ml":995:6: else:test_expect_test:995 + │ └─"test/test_expect_test.ml":999:10: + │ └─"test/test_expect_test.ml":999:14: result + │ ├─"test/test_expect_test.ml":999:44: then:test_expect_test:999 + │ └─result = 8 + └─track_branches = 8 + 8 + "test/test_expect_test.ml":986:37: track_branches + ├─x = 3 + ├─"test/test_expect_test.ml":988:6: then:test_expect_test:988 + │ └─"test/test_expect_test.ml":992:14: result + │ └─result = 3 + └─track_branches = 3 + 3 |}] let%expect_test "%track_show PrintBox not tracking anonymous functions with debug_notrace" @@ -1030,12 +1042,13 @@ let%expect_test "%track_show PrintBox not tracking anonymous functions with debu [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":1020:27: track_foo + "test/test_expect_test.ml":1032:27: track_foo ├─x = 8 - ├─"test/test_expect_test.ml":1023:4: fun:test_expect_test:1023 + ├─"test/test_expect_test.ml":1035:4: fun:test_expect_test:1035 │ └─z = 8 └─track_foo = 8 - 8 |}] + 8 + |}] let%expect_test "respect scope of nested extension points" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -1063,22 +1076,22 @@ let%expect_test "respect scope of nested extension points" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":1042:37: track_branches - ├─x = 8 - ├─"test/test_expect_test.ml":1051:6: else:test_expect_test:1051 - │ └─"test/test_expect_test.ml":1055:25: result - │ ├─"test/test_expect_test.ml":1055:55: then:test_expect_test:1055 - │ └─result = 8 - └─track_branches = 8 - 8 - "test/test_expect_test.ml":1042:37: track_branches - ├─x = 3 - ├─"test/test_expect_test.ml":1044:6: then:test_expect_test:1044 - │ └─"test/test_expect_test.ml":1048:25: result - │ └─result = 3 - └─track_branches = 3 - 3 + BEGIN DEBUG SESSION + "test/test_expect_test.ml":1055:37: track_branches + ├─x = 8 + ├─"test/test_expect_test.ml":1064:6: else:test_expect_test:1064 + │ └─"test/test_expect_test.ml":1068:25: result + │ ├─"test/test_expect_test.ml":1068:55: then:test_expect_test:1068 + │ └─result = 8 + └─track_branches = 8 + 8 + "test/test_expect_test.ml":1055:37: track_branches + ├─x = 3 + ├─"test/test_expect_test.ml":1057:6: then:test_expect_test:1057 + │ └─"test/test_expect_test.ml":1061:25: result + │ └─result = 3 + └─track_branches = 3 + 3 |}] let%expect_test "%debug_show un-annotated toplevel fun" = @@ -1100,11 +1113,11 @@ let%expect_test "%debug_show un-annotated toplevel fun" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":1086:27: anonymous + "test/test_expect_test.ml":1099:27: anonymous └─"We do log this function" 6 6 - |}] + |}] let%expect_test "%debug_show nested un-annotated toplevel fun" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -1128,12 +1141,12 @@ let%expect_test "%debug_show nested un-annotated toplevel fun" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":1111:25: wrapper - "test/test_expect_test.ml":1112:29: anonymous + "test/test_expect_test.ml":1124:25: wrapper + "test/test_expect_test.ml":1125:29: anonymous └─"We do log this function" 6 6 - |}] + |}] let%expect_test "%track_this_show no return type anonymous fun" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -1147,10 +1160,10 @@ let%expect_test "%track_this_show no return type anonymous fun" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":1140:32: anonymous + "test/test_expect_test.ml":1153:32: anonymous └─x = 3 6 - |}]; + |}]; let%track_this_show anonymous (x : int) = Array.fold_left ( + ) 0 @@ Array.init (x + 1) (fun (i : int) -> i) in @@ -1160,17 +1173,17 @@ let%expect_test "%track_this_show no return type anonymous fun" = in [%expect {| - "test/test_expect_test.ml":1154:32: anonymous - ├─x = 3 - ├─"test/test_expect_test.ml":1155:50: fun:test_expect_test:1155 - │ └─i = 0 - ├─"test/test_expect_test.ml":1155:50: fun:test_expect_test:1155 - │ └─i = 1 - ├─"test/test_expect_test.ml":1155:50: fun:test_expect_test:1155 - │ └─i = 2 - └─"test/test_expect_test.ml":1155:50: fun:test_expect_test:1155 - └─i = 3 - 6 + "test/test_expect_test.ml":1167:32: anonymous + ├─x = 3 + ├─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + │ └─i = 0 + ├─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + │ └─i = 1 + ├─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + │ └─i = 2 + └─"test/test_expect_test.ml":1168:50: fun:test_expect_test:1168 + └─i = 3 + 6 |}] let%expect_test "%track_this_show anonymous fun, num children exceeded" = @@ -1191,82 +1204,82 @@ let%expect_test "%track_this_show anonymous fun, num children exceeded" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":1178:40: loop_exceeded - ├─x = 3 - └─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - ├─i = 0 - ├─"test/test_expect_test.ml":1185:17: z - │ └─z = 1 - └─"test/test_expect_test.ml":1186:35: else:test_expect_test:1186 - └─"test/test_expect_test.ml":1178:40: loop_exceeded - ├─x = 2 - └─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - ├─i = 0 - ├─"test/test_expect_test.ml":1185:17: z - │ └─z = 0 - └─"test/test_expect_test.ml":1186:35: else:test_expect_test:1186 - └─"test/test_expect_test.ml":1178:40: loop_exceeded - ├─x = 1 - └─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - ├─i = 0 - ├─"test/test_expect_test.ml":1185:17: z - │ └─z = 0 - └─"test/test_expect_test.ml":1186:35: else:test_expect_test:1186 - └─"test/test_expect_test.ml":1178:40: loop_exceeded - ├─x = 0 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 0 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 0 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 1 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 1 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 2 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 2 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 3 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 3 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 4 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 4 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 5 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 5 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 6 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 6 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 7 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 7 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 8 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 8 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - ├─"test/test_expect_test.ml":1184:11: fun:test_expect_test:1184 - │ ├─i = 9 - │ ├─"test/test_expect_test.ml":1185:17: z - │ │ └─z = 9 - │ └─"test/test_expect_test.ml":1186:28: then:test_expect_test:1186 - └─fun:test_expect_test:1184 = - Raised exception: ppx_minidebug: max_num_children exceeded + BEGIN DEBUG SESSION + "test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 3 + └─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + ├─i = 0 + ├─"test/test_expect_test.ml":1198:17: z + │ └─z = 1 + └─"test/test_expect_test.ml":1199:35: else:test_expect_test:1199 + └─"test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 2 + └─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + ├─i = 0 + ├─"test/test_expect_test.ml":1198:17: z + │ └─z = 0 + └─"test/test_expect_test.ml":1199:35: else:test_expect_test:1199 + └─"test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 1 + └─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + ├─i = 0 + ├─"test/test_expect_test.ml":1198:17: z + │ └─z = 0 + └─"test/test_expect_test.ml":1199:35: else:test_expect_test:1199 + └─"test/test_expect_test.ml":1191:40: loop_exceeded + ├─x = 0 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 0 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 0 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 1 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 1 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 2 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 2 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 3 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 3 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 4 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 4 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 5 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 5 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 6 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 6 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 7 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 7 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 8 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 8 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + ├─"test/test_expect_test.ml":1197:11: fun:test_expect_test:1197 + │ ├─i = 9 + │ ├─"test/test_expect_test.ml":1198:17: z + │ │ └─z = 9 + │ └─"test/test_expect_test.ml":1199:28: then:test_expect_test:1199 + └─fun:test_expect_test:1197 = + Raised exception: ppx_minidebug: max_num_children exceeded |}] let%expect_test "%track_this_show anonymous fun, truncated children" = @@ -1285,40 +1298,40 @@ let%expect_test "%track_this_show anonymous fun, truncated children" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":1274:40: loop_exceeded - ├─ - ├─"test/test_expect_test.ml":1278:9: fun:test_expect_test:1278 - │ ├─ - │ ├─"test/test_expect_test.ml":1279:15: z - │ │ └─z = 7 - │ └─"test/test_expect_test.ml":1280:33: else:test_expect_test:1280 - │ └─"test/test_expect_test.ml":1274:40: loop_exceeded - │ ├─ - │ ├─"test/test_expect_test.ml":1278:9: fun:test_expect_test:1278 - │ │ ├─ - │ │ ├─"test/test_expect_test.ml":1279:15: z - │ │ │ └─z = 9 - │ │ └─"test/test_expect_test.ml":1280:33: else:test_expect_test:1280 - │ │ └─"test/test_expect_test.ml":1274:40: loop_exceeded - │ │ ├─ - │ │ ├─"test/test_expect_test.ml":1278:9: fun:test_expect_test:1278 - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":1279:15: z - │ │ │ │ └─z = 14 - │ │ │ └─"test/test_expect_test.ml":1280:33: else:test_expect_test:1280 - │ │ │ └─"test/test_expect_test.ml":1274:40: loop_exceeded - │ │ │ ├─ - │ │ │ ├─"test/test_expect_test.ml":1278:9: fun:test_expect_test:1278 - │ │ │ │ ├─ - │ │ │ │ ├─"test/test_expect_test.ml":1279:15: z - │ │ │ │ │ └─z = 29 - │ │ │ │ └─"test/test_expect_test.ml":1280:26: then:test_expect_test:1280 - │ │ │ └─loop_exceeded = 435 - │ │ └─loop_exceeded = 6630 - │ └─loop_exceeded = 66345 - └─loop_exceeded = 464436 - 464436 + BEGIN DEBUG SESSION + "test/test_expect_test.ml":1287:40: loop_exceeded + ├─ + ├─"test/test_expect_test.ml":1291:9: fun:test_expect_test:1291 + │ ├─ + │ ├─"test/test_expect_test.ml":1292:15: z + │ │ └─z = 7 + │ └─"test/test_expect_test.ml":1293:33: else:test_expect_test:1293 + │ └─"test/test_expect_test.ml":1287:40: loop_exceeded + │ ├─ + │ ├─"test/test_expect_test.ml":1291:9: fun:test_expect_test:1291 + │ │ ├─ + │ │ ├─"test/test_expect_test.ml":1292:15: z + │ │ │ └─z = 9 + │ │ └─"test/test_expect_test.ml":1293:33: else:test_expect_test:1293 + │ │ └─"test/test_expect_test.ml":1287:40: loop_exceeded + │ │ ├─ + │ │ ├─"test/test_expect_test.ml":1291:9: fun:test_expect_test:1291 + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":1292:15: z + │ │ │ │ └─z = 14 + │ │ │ └─"test/test_expect_test.ml":1293:33: else:test_expect_test:1293 + │ │ │ └─"test/test_expect_test.ml":1287:40: loop_exceeded + │ │ │ ├─ + │ │ │ ├─"test/test_expect_test.ml":1291:9: fun:test_expect_test:1291 + │ │ │ │ ├─ + │ │ │ │ ├─"test/test_expect_test.ml":1292:15: z + │ │ │ │ │ └─z = 29 + │ │ │ │ └─"test/test_expect_test.ml":1293:26: then:test_expect_test:1293 + │ │ │ └─loop_exceeded = 435 + │ │ └─loop_exceeded = 6630 + │ └─loop_exceeded = 66345 + └─loop_exceeded = 464436 + 464436 |}] module type T = sig @@ -1346,11 +1359,11 @@ let%expect_test "%debug_this_show function with abstract type" = in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":1332:26: foo - ├─c = 1 - └─foo = 2 - 2 + BEGIN DEBUG SESSION + "test/test_expect_test.ml":1345:26: foo + ├─c = 1 + └─foo = 2 + 2 |}] let%expect_test "%debug_this_show PrintBox values_first_mode to stdout with exception" = @@ -1366,48 +1379,49 @@ let%expect_test "%debug_this_show PrintBox values_first_mode to stdout with exce in [%expect {| - BEGIN DEBUG SESSION - loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 7 - ├─z = 3 - │ └─"test/test_expect_test.ml":1359:8 - └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 6 - ├─z = 2 - │ └─"test/test_expect_test.ml":1359:8 + BEGIN DEBUG SESSION + loop_truncated + ├─"test/test_expect_test.ml":1371:41 + ├─x = 7 + ├─z = 3 + │ └─"test/test_expect_test.ml":1372:8 └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 5 + ├─"test/test_expect_test.ml":1371:41 + ├─x = 6 ├─z = 2 - │ └─"test/test_expect_test.ml":1359:8 + │ └─"test/test_expect_test.ml":1372:8 └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 4 - ├─z = 1 - │ └─"test/test_expect_test.ml":1359:8 + ├─"test/test_expect_test.ml":1371:41 + ├─x = 5 + ├─z = 2 + │ └─"test/test_expect_test.ml":1372:8 └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 3 + ├─"test/test_expect_test.ml":1371:41 + ├─x = 4 ├─z = 1 - │ └─"test/test_expect_test.ml":1359:8 + │ └─"test/test_expect_test.ml":1372:8 └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 2 - ├─z = 0 - │ └─"test/test_expect_test.ml":1359:8 + ├─"test/test_expect_test.ml":1371:41 + ├─x = 3 + ├─z = 1 + │ └─"test/test_expect_test.ml":1372:8 └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 1 + ├─"test/test_expect_test.ml":1371:41 + ├─x = 2 ├─z = 0 - │ └─"test/test_expect_test.ml":1359:8 + │ └─"test/test_expect_test.ml":1372:8 └─loop_truncated - ├─"test/test_expect_test.ml":1358:41 - ├─x = 0 - └─z = 0 - └─"test/test_expect_test.ml":1359:8 - Raised exception. |}] + ├─"test/test_expect_test.ml":1371:41 + ├─x = 1 + ├─z = 0 + │ └─"test/test_expect_test.ml":1372:8 + └─loop_truncated + ├─"test/test_expect_test.ml":1371:41 + ├─x = 0 + └─z = 0 + └─"test/test_expect_test.ml":1372:8 + Raised exception. + |}] let%expect_test "%debug_this_show PrintBox values_first_mode to stdout num children \ exceeded linear" = @@ -1429,31 +1443,32 @@ let%expect_test "%debug_this_show PrintBox values_first_mode to stdout num child {| BEGIN DEBUG SESSION _bar - ├─"test/test_expect_test.ml":1417:26 + ├─"test/test_expect_test.ml":1431:26 ├─_baz = 0 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 2 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 4 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 6 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 8 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 10 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 12 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 14 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 16 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 18 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 ├─_baz = 20 - │ └─"test/test_expect_test.ml":1421:16 + │ └─"test/test_expect_test.ml":1435:16 └─_baz = - Raised exception: ppx_minidebug: max_num_children exceeded |}] + Raised exception: ppx_minidebug: max_num_children exceeded + |}] let%expect_test "%track_this_show PrintBox values_first_mode to stdout track for-loop" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -1472,46 +1487,47 @@ let%expect_test "%track_this_show PrintBox values_first_mode to stdout track for in [%expect {| - BEGIN DEBUG SESSION - _bar = () - ├─"test/test_expect_test.ml":1462:26 - └─for:test_expect_test:1465 - ├─"test/test_expect_test.ml":1465:10 - ├─i = 0 - ├─ - │ ├─"test/test_expect_test.ml":1465:14 - │ └─_baz = 0 - │ └─"test/test_expect_test.ml":1466:16 - ├─i = 1 - ├─ - │ ├─"test/test_expect_test.ml":1465:14 - │ └─_baz = 2 - │ └─"test/test_expect_test.ml":1466:16 - ├─i = 2 - ├─ - │ ├─"test/test_expect_test.ml":1465:14 - │ └─_baz = 4 - │ └─"test/test_expect_test.ml":1466:16 - ├─i = 3 - ├─ - │ ├─"test/test_expect_test.ml":1465:14 - │ └─_baz = 6 - │ └─"test/test_expect_test.ml":1466:16 - ├─i = 4 - ├─ - │ ├─"test/test_expect_test.ml":1465:14 - │ └─_baz = 8 - │ └─"test/test_expect_test.ml":1466:16 - ├─i = 5 - ├─ - │ ├─"test/test_expect_test.ml":1465:14 - │ └─_baz = 10 - │ └─"test/test_expect_test.ml":1466:16 - ├─i = 6 - └─ - ├─"test/test_expect_test.ml":1465:14 - └─_baz = 12 - └─"test/test_expect_test.ml":1466:16 |}] + BEGIN DEBUG SESSION + _bar = () + ├─"test/test_expect_test.ml":1477:26 + └─for:test_expect_test:1480 + ├─"test/test_expect_test.ml":1480:10 + ├─i = 0 + ├─ + │ ├─"test/test_expect_test.ml":1480:14 + │ └─_baz = 0 + │ └─"test/test_expect_test.ml":1481:16 + ├─i = 1 + ├─ + │ ├─"test/test_expect_test.ml":1480:14 + │ └─_baz = 2 + │ └─"test/test_expect_test.ml":1481:16 + ├─i = 2 + ├─ + │ ├─"test/test_expect_test.ml":1480:14 + │ └─_baz = 4 + │ └─"test/test_expect_test.ml":1481:16 + ├─i = 3 + ├─ + │ ├─"test/test_expect_test.ml":1480:14 + │ └─_baz = 6 + │ └─"test/test_expect_test.ml":1481:16 + ├─i = 4 + ├─ + │ ├─"test/test_expect_test.ml":1480:14 + │ └─_baz = 8 + │ └─"test/test_expect_test.ml":1481:16 + ├─i = 5 + ├─ + │ ├─"test/test_expect_test.ml":1480:14 + │ └─_baz = 10 + │ └─"test/test_expect_test.ml":1481:16 + ├─i = 6 + └─ + ├─"test/test_expect_test.ml":1480:14 + └─_baz = 12 + └─"test/test_expect_test.ml":1481:16 + |}] let%expect_test "%debug_show PrintBox values_first_mode to stdout num children exceeded \ nested" = @@ -1532,47 +1548,48 @@ let%expect_test "%debug_show PrintBox values_first_mode to stdout num children e in [%expect {| - BEGIN DEBUG SESSION - loop_exceeded - ├─"test/test_expect_test.ml":1519:40 - ├─x = 3 - ├─z = 1 - │ └─"test/test_expect_test.ml":1526:17 + BEGIN DEBUG SESSION + loop_exceeded + ├─"test/test_expect_test.ml":1535:40 + ├─x = 3 + ├─z = 1 + │ └─"test/test_expect_test.ml":1542:17 + └─loop_exceeded + ├─"test/test_expect_test.ml":1535:40 + ├─x = 2 + ├─z = 0 + │ └─"test/test_expect_test.ml":1542:17 └─loop_exceeded - ├─"test/test_expect_test.ml":1519:40 - ├─x = 2 + ├─"test/test_expect_test.ml":1535:40 + ├─x = 1 ├─z = 0 - │ └─"test/test_expect_test.ml":1526:17 + │ └─"test/test_expect_test.ml":1542:17 └─loop_exceeded - ├─"test/test_expect_test.ml":1519:40 - ├─x = 1 + ├─"test/test_expect_test.ml":1535:40 + ├─x = 0 ├─z = 0 - │ └─"test/test_expect_test.ml":1526:17 - └─loop_exceeded - ├─"test/test_expect_test.ml":1519:40 - ├─x = 0 - ├─z = 0 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 1 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 2 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 3 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 4 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 5 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 6 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 7 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 8 - │ └─"test/test_expect_test.ml":1526:17 - ├─z = 9 - │ └─"test/test_expect_test.ml":1526:17 - └─z = - Raised exception: ppx_minidebug: max_num_children exceeded |}] + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 1 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 2 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 3 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 4 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 5 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 6 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 7 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 8 + │ └─"test/test_expect_test.ml":1542:17 + ├─z = 9 + │ └─"test/test_expect_test.ml":1542:17 + └─z = + Raised exception: ppx_minidebug: max_num_children exceeded + |}] let%expect_test "%debug_this_show elapsed times PrintBox values_first_mode to stdout \ nested, truncated children" = @@ -1599,145 +1616,146 @@ let%expect_test "%debug_this_show elapsed times PrintBox values_first_mode to st print_endline output; [%expect {| - BEGIN DEBUG SESSION - loop_exceeded = 58435 - ├─"test/test_expect_test.ml":1583:40 + BEGIN DEBUG SESSION + loop_exceeded = 58435 + ├─"test/test_expect_test.ml":1600:40 + ├─ + ├─z = 4 + │ └─"test/test_expect_test.ml":1605:15 + ├─loop_exceeded = 11685 + │ ├─"test/test_expect_test.ml":1600:40 + │ ├─ + │ ├─z = 4 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─loop_exceeded = 1945 + │ │ ├─"test/test_expect_test.ml":1600:40 + │ │ ├─ + │ │ ├─z = 8 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─loop_exceeded = 190 + │ │ │ ├─"test/test_expect_test.ml":1600:40 + │ │ │ ├─ + │ │ │ ├─z = 16 + │ │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ │ ├─z = 17 + │ │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ │ ├─z = 18 + │ │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ │ └─z = 19 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 9 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ └─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":1600:40 + │ │ ├─ + │ │ ├─z = 16 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 17 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 18 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ └─z = 19 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 5 + │ │ └─"test/test_expect_test.ml":1605:15 + │ └─loop_exceeded = 1945 + │ ├─"test/test_expect_test.ml":1600:40 + │ ├─ + │ ├─z = 8 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":1600:40 + │ │ ├─ + │ │ ├─z = 16 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 17 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 18 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ └─z = 19 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 9 + │ │ └─"test/test_expect_test.ml":1605:15 + │ └─loop_exceeded = 190 + │ ├─"test/test_expect_test.ml":1600:40 + │ ├─ + │ ├─z = 16 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 17 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 18 + │ │ └─"test/test_expect_test.ml":1605:15 + │ └─z = 19 + │ └─"test/test_expect_test.ml":1605:15 + ├─z = 5 + │ └─"test/test_expect_test.ml":1605:15 + └─loop_exceeded = 11685 + ├─"test/test_expect_test.ml":1600:40 ├─ ├─z = 4 - │ └─"test/test_expect_test.ml":1588:15 - ├─loop_exceeded = 11685 - │ ├─"test/test_expect_test.ml":1583:40 + │ └─"test/test_expect_test.ml":1605:15 + ├─loop_exceeded = 1945 + │ ├─"test/test_expect_test.ml":1600:40 │ ├─ - │ ├─z = 4 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─loop_exceeded = 1945 - │ │ ├─"test/test_expect_test.ml":1583:40 + │ ├─z = 8 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─loop_exceeded = 190 + │ │ ├─"test/test_expect_test.ml":1600:40 │ │ ├─ - │ │ ├─z = 8 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─loop_exceeded = 190 - │ │ │ ├─"test/test_expect_test.ml":1583:40 - │ │ │ ├─ - │ │ │ ├─z = 16 - │ │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ │ ├─z = 17 - │ │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ │ ├─z = 18 - │ │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ │ └─z = 19 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 9 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ └─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":1583:40 - │ │ ├─ - │ │ ├─z = 16 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 17 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 18 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ └─z = 19 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 5 - │ │ └─"test/test_expect_test.ml":1588:15 - │ └─loop_exceeded = 1945 - │ ├─"test/test_expect_test.ml":1583:40 + │ │ ├─z = 16 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 17 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ ├─z = 18 + │ │ │ └─"test/test_expect_test.ml":1605:15 + │ │ └─z = 19 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 9 + │ │ └─"test/test_expect_test.ml":1605:15 + │ └─loop_exceeded = 190 + │ ├─"test/test_expect_test.ml":1600:40 │ ├─ - │ ├─z = 8 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":1583:40 - │ │ ├─ - │ │ ├─z = 16 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 17 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 18 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ └─z = 19 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 9 - │ │ └─"test/test_expect_test.ml":1588:15 - │ └─loop_exceeded = 190 - │ ├─"test/test_expect_test.ml":1583:40 - │ ├─ - │ ├─z = 16 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 17 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 18 - │ │ └─"test/test_expect_test.ml":1588:15 - │ └─z = 19 - │ └─"test/test_expect_test.ml":1588:15 + │ ├─z = 16 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 17 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 18 + │ │ └─"test/test_expect_test.ml":1605:15 + │ └─z = 19 + │ └─"test/test_expect_test.ml":1605:15 ├─z = 5 - │ └─"test/test_expect_test.ml":1588:15 - └─loop_exceeded = 11685 - ├─"test/test_expect_test.ml":1583:40 + │ └─"test/test_expect_test.ml":1605:15 + └─loop_exceeded = 1945 + ├─"test/test_expect_test.ml":1600:40 ├─ - ├─z = 4 - │ └─"test/test_expect_test.ml":1588:15 - ├─loop_exceeded = 1945 - │ ├─"test/test_expect_test.ml":1583:40 + ├─z = 8 + │ └─"test/test_expect_test.ml":1605:15 + ├─loop_exceeded = 190 + │ ├─"test/test_expect_test.ml":1600:40 │ ├─ - │ ├─z = 8 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─loop_exceeded = 190 - │ │ ├─"test/test_expect_test.ml":1583:40 - │ │ ├─ - │ │ ├─z = 16 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 17 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ ├─z = 18 - │ │ │ └─"test/test_expect_test.ml":1588:15 - │ │ └─z = 19 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 9 - │ │ └─"test/test_expect_test.ml":1588:15 - │ └─loop_exceeded = 190 - │ ├─"test/test_expect_test.ml":1583:40 - │ ├─ - │ ├─z = 16 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 17 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 18 - │ │ └─"test/test_expect_test.ml":1588:15 - │ └─z = 19 - │ └─"test/test_expect_test.ml":1588:15 - ├─z = 5 - │ └─"test/test_expect_test.ml":1588:15 - └─loop_exceeded = 1945 - ├─"test/test_expect_test.ml":1583:40 + │ ├─z = 16 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 17 + │ │ └─"test/test_expect_test.ml":1605:15 + │ ├─z = 18 + │ │ └─"test/test_expect_test.ml":1605:15 + │ └─z = 19 + │ └─"test/test_expect_test.ml":1605:15 + ├─z = 9 + │ └─"test/test_expect_test.ml":1605:15 + └─loop_exceeded = 190 + ├─"test/test_expect_test.ml":1600:40 ├─ - ├─z = 8 - │ └─"test/test_expect_test.ml":1588:15 - ├─loop_exceeded = 190 - │ ├─"test/test_expect_test.ml":1583:40 - │ ├─ - │ ├─z = 16 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 17 - │ │ └─"test/test_expect_test.ml":1588:15 - │ ├─z = 18 - │ │ └─"test/test_expect_test.ml":1588:15 - │ └─z = 19 - │ └─"test/test_expect_test.ml":1588:15 - ├─z = 9 - │ └─"test/test_expect_test.ml":1588:15 - └─loop_exceeded = 190 - ├─"test/test_expect_test.ml":1583:40 - ├─ - ├─z = 16 - │ └─"test/test_expect_test.ml":1588:15 - ├─z = 17 - │ └─"test/test_expect_test.ml":1588:15 - ├─z = 18 - │ └─"test/test_expect_test.ml":1588:15 - └─z = 19 - └─"test/test_expect_test.ml":1588:15 - 58435 |}] + ├─z = 16 + │ └─"test/test_expect_test.ml":1605:15 + ├─z = 17 + │ └─"test/test_expect_test.ml":1605:15 + ├─z = 18 + │ └─"test/test_expect_test.ml":1605:15 + └─z = 19 + └─"test/test_expect_test.ml":1605:15 + 58435 + |}] let%expect_test "%debug_this_show PrintBox values_first_mode to stdout highlight" = let module Debug_runtime = @@ -1750,62 +1768,63 @@ let%expect_test "%debug_this_show PrintBox values_first_mode to stdout highlight print_endline @@ Int.to_string @@ loop_highlight 7; [%expect {| - BEGIN DEBUG SESSION - ┌──────────────────┐ - │loop_highlight = 9│ + BEGIN DEBUG SESSION + ┌──────────────────┐ + │loop_highlight = 9│ + ├──────────────────┘ + ├─"test/test_expect_test.ml":1764:41 + ├─x = 7 + ├─┬─────┐ + │ │z = 3│ + │ ├─────┘ + │ └─"test/test_expect_test.ml":1765:8 + └─┬──────────────────┐ + │loop_highlight = 6│ ├──────────────────┘ - ├─"test/test_expect_test.ml":1746:41 - ├─x = 7 - ├─┬─────┐ - │ │z = 3│ - │ ├─────┘ - │ └─"test/test_expect_test.ml":1747:8 + ├─"test/test_expect_test.ml":1764:41 + ├─x = 6 + ├─z = 2 + │ └─"test/test_expect_test.ml":1765:8 └─┬──────────────────┐ - │loop_highlight = 6│ + │loop_highlight = 4│ ├──────────────────┘ - ├─"test/test_expect_test.ml":1746:41 - ├─x = 6 + ├─"test/test_expect_test.ml":1764:41 + ├─x = 5 ├─z = 2 - │ └─"test/test_expect_test.ml":1747:8 + │ └─"test/test_expect_test.ml":1765:8 └─┬──────────────────┐ - │loop_highlight = 4│ + │loop_highlight = 2│ ├──────────────────┘ - ├─"test/test_expect_test.ml":1746:41 - ├─x = 5 - ├─z = 2 - │ └─"test/test_expect_test.ml":1747:8 + ├─"test/test_expect_test.ml":1764:41 + ├─x = 4 + ├─z = 1 + │ └─"test/test_expect_test.ml":1765:8 └─┬──────────────────┐ - │loop_highlight = 2│ + │loop_highlight = 1│ ├──────────────────┘ - ├─"test/test_expect_test.ml":1746:41 - ├─x = 4 + ├─"test/test_expect_test.ml":1764:41 + ├─┬─────┐ + │ │x = 3│ + │ └─────┘ ├─z = 1 - │ └─"test/test_expect_test.ml":1747:8 - └─┬──────────────────┐ - │loop_highlight = 1│ - ├──────────────────┘ - ├─"test/test_expect_test.ml":1746:41 - ├─┬─────┐ - │ │x = 3│ - │ └─────┘ - ├─z = 1 - │ └─"test/test_expect_test.ml":1747:8 + │ └─"test/test_expect_test.ml":1765:8 + └─loop_highlight = 0 + ├─"test/test_expect_test.ml":1764:41 + ├─x = 2 + ├─z = 0 + │ └─"test/test_expect_test.ml":1765:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":1746:41 - ├─x = 2 + ├─"test/test_expect_test.ml":1764:41 + ├─x = 1 ├─z = 0 - │ └─"test/test_expect_test.ml":1747:8 + │ └─"test/test_expect_test.ml":1765:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":1746:41 - ├─x = 1 - ├─z = 0 - │ └─"test/test_expect_test.ml":1747:8 - └─loop_highlight = 0 - ├─"test/test_expect_test.ml":1746:41 - ├─x = 0 - └─z = 0 - └─"test/test_expect_test.ml":1747:8 - 9 |}] + ├─"test/test_expect_test.ml":1764:41 + ├─x = 0 + └─z = 0 + └─"test/test_expect_test.ml":1765:8 + 9 + |}] let%expect_test "%track_this_show PrintBox values_first_mode tracking" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -1821,23 +1840,23 @@ let%expect_test "%track_this_show PrintBox values_first_mode tracking" = in [%expect {| - BEGIN DEBUG SESSION - track_branches = 4 - ├─"test/test_expect_test.ml":1812:37 - ├─x = 7 - └─else:test_expect_test:1814 - ├─"test/test_expect_test.ml":1814:9 - └─ - └─"test/test_expect_test.ml":1814:36 - 4 - track_branches = -3 - ├─"test/test_expect_test.ml":1812:37 - ├─x = 3 - └─then:test_expect_test:1813 - ├─"test/test_expect_test.ml":1813:18 - └─ - └─"test/test_expect_test.ml":1813:54 - -3 + BEGIN DEBUG SESSION + track_branches = 4 + ├─"test/test_expect_test.ml":1831:37 + ├─x = 7 + └─else:test_expect_test:1833 + ├─"test/test_expect_test.ml":1833:9 + └─ + └─"test/test_expect_test.ml":1833:36 + 4 + track_branches = -3 + ├─"test/test_expect_test.ml":1831:37 + ├─x = 3 + └─then:test_expect_test:1832 + ├─"test/test_expect_test.ml":1832:18 + └─ + └─"test/test_expect_test.ml":1832:54 + -3 |}] let%expect_test "%track_show PrintBox values_first_mode to stdout no return type \ @@ -1852,23 +1871,23 @@ let%expect_test "%track_show PrintBox values_first_mode to stdout no return type in [%expect {| - BEGIN DEBUG SESSION - anonymous - ├─"test/test_expect_test.ml":1846:32 - ├─x = 3 - ├─fun:test_expect_test:1847 - │ ├─"test/test_expect_test.ml":1847:50 - │ └─i = 0 - ├─fun:test_expect_test:1847 - │ ├─"test/test_expect_test.ml":1847:50 - │ └─i = 1 - ├─fun:test_expect_test:1847 - │ ├─"test/test_expect_test.ml":1847:50 - │ └─i = 2 - └─fun:test_expect_test:1847 - ├─"test/test_expect_test.ml":1847:50 - └─i = 3 - 6 + BEGIN DEBUG SESSION + anonymous + ├─"test/test_expect_test.ml":1865:32 + ├─x = 3 + ├─fun:test_expect_test:1866 + │ ├─"test/test_expect_test.ml":1866:50 + │ └─i = 0 + ├─fun:test_expect_test:1866 + │ ├─"test/test_expect_test.ml":1866:50 + │ └─i = 1 + ├─fun:test_expect_test:1866 + │ ├─"test/test_expect_test.ml":1866:50 + │ └─i = 2 + └─fun:test_expect_test:1866 + ├─"test/test_expect_test.ml":1866:50 + └─i = 3 + 6 |}] let%expect_test "%debug_show records" = @@ -1887,24 +1906,25 @@ let%expect_test "%debug_show records" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":1876:21: bar + "test/test_expect_test.ml":1895:21: bar ├─first = 7 ├─second = 42 - ├─"test/test_expect_test.ml":1877:8: {first=a; second=b} + ├─"test/test_expect_test.ml":1896:8: {first=a; second=b} │ ├─a = 7 │ └─b = 45 - ├─"test/test_expect_test.ml":1878:8: y + ├─"test/test_expect_test.ml":1897:8: y │ └─y = 8 └─bar = 336 336 - "test/test_expect_test.ml":1882:10: baz + "test/test_expect_test.ml":1901:10: baz ├─first = 7 ├─second = 42 - ├─"test/test_expect_test.ml":1883:8: {first; second} + ├─"test/test_expect_test.ml":1902:8: {first; second} │ ├─first = 8 │ └─second = 45 └─baz = 109 - 109 |}] + 109 + |}] let%expect_test "%debug_show tuples" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:false ()) in @@ -1924,28 +1944,29 @@ let%expect_test "%debug_show tuples" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":1911:21: bar + "test/test_expect_test.ml":1931:21: bar ├─first = 7 ├─second = 42 - ├─"test/test_expect_test.ml":1912:8: y + ├─"test/test_expect_test.ml":1932:8: y │ └─y = 8 └─bar = 336 336 - "test/test_expect_test.ml":1921:6: (r1, r2) - ├─"test/test_expect_test.ml":1916:10: baz + "test/test_expect_test.ml":1941:6: (r1, r2) + ├─"test/test_expect_test.ml":1936:10: baz │ ├─first = 7 │ ├─second = 42 - │ ├─"test/test_expect_test.ml":1917:8: (y, z) + │ ├─"test/test_expect_test.ml":1937:8: (y, z) │ │ ├─y = 8 │ │ └─z = 3 - │ ├─"test/test_expect_test.ml":1918:8: (a, b) + │ ├─"test/test_expect_test.ml":1938:8: (a, b) │ │ ├─a = 8 │ │ └─b = 45 │ └─baz = (339, 109) ├─r1 = 339 └─r2 = 109 339 - 109 |}] + 109 + |}] let%expect_test "%debug_show records values_first_mode" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -1962,29 +1983,30 @@ let%expect_test "%debug_show records values_first_mode" = let () = print_endline @@ Int.to_string @@ baz { first = 7; second = 42 } in [%expect {| - BEGIN DEBUG SESSION - bar = 336 - ├─"test/test_expect_test.ml":1952:21 - ├─first = 7 - ├─second = 42 - ├─{first=a; second=b} - │ ├─"test/test_expect_test.ml":1953:8 - │ └─ - │ ├─a = 7 - │ └─b = 45 - └─y = 8 - └─"test/test_expect_test.ml":1954:8 - 336 - baz = 109 - ├─"test/test_expect_test.ml":1958:10 - ├─first = 7 - ├─second = 42 - └─{first; second} - ├─"test/test_expect_test.ml":1959:8 - └─ - ├─first = 8 - └─second = 45 - 109 |}] + BEGIN DEBUG SESSION + bar = 336 + ├─"test/test_expect_test.ml":1973:21 + ├─first = 7 + ├─second = 42 + ├─{first=a; second=b} + │ ├─"test/test_expect_test.ml":1974:8 + │ └─ + │ ├─a = 7 + │ └─b = 45 + └─y = 8 + └─"test/test_expect_test.ml":1975:8 + 336 + baz = 109 + ├─"test/test_expect_test.ml":1979:10 + ├─first = 7 + ├─second = 42 + └─{first; second} + ├─"test/test_expect_test.ml":1980:8 + └─ + ├─first = 8 + └─second = 45 + 109 + |}] let%expect_test "%debug_show tuples values_first_mode" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2005,33 +2027,34 @@ let%expect_test "%debug_show tuples values_first_mode" = {| BEGIN DEBUG SESSION bar = 336 - ├─"test/test_expect_test.ml":1991:21 + ├─"test/test_expect_test.ml":2013:21 ├─first = 7 ├─second = 42 └─y = 8 - └─"test/test_expect_test.ml":1992:8 + └─"test/test_expect_test.ml":2014:8 336 (r1, r2) - ├─"test/test_expect_test.ml":2001:6 + ├─"test/test_expect_test.ml":2023:6 ├─ │ ├─r1 = 339 │ └─r2 = 109 └─baz = (339, 109) - ├─"test/test_expect_test.ml":1996:10 + ├─"test/test_expect_test.ml":2018:10 ├─first = 7 ├─second = 42 ├─(y, z) - │ ├─"test/test_expect_test.ml":1997:8 + │ ├─"test/test_expect_test.ml":2019:8 │ └─ │ ├─y = 8 │ └─z = 3 └─(a, b) - ├─"test/test_expect_test.ml":1998:8 + ├─"test/test_expect_test.ml":2020:8 └─ ├─a = 8 └─b = 45 339 - 109 |}] + 109 + |}] type 'a irrefutable = Zero of 'a type ('a, 'b) left_right = Left of 'a | Right of 'b @@ -2057,28 +2080,29 @@ let%expect_test "%track_show variants values_first_mode" = let () = print_endline @@ Int.to_string @@ foo (Right (Three 0)) in [%expect {| - BEGIN DEBUG SESSION - bar = 16 - ├─"test/test_expect_test.ml":2042:21 - ├─x = 7 - └─y = 8 - └─"test/test_expect_test.ml":2043:8 - 16 - baz = 5 - ├─"test/test_expect_test.ml":2048:24 - ├─ Left x - └─x = 4 - 5 - baz = 6 - ├─"test/test_expect_test.ml":2049:31 - ├─ Right Two y - └─y = 3 - 6 - foo = 3 - ├─"test/test_expect_test.ml":2052:10 - └─ - └─"test/test_expect_test.ml":2053:81 - 3 |}] + BEGIN DEBUG SESSION + bar = 16 + ├─"test/test_expect_test.ml":2065:21 + ├─x = 7 + └─y = 8 + └─"test/test_expect_test.ml":2066:8 + 16 + baz = 5 + ├─"test/test_expect_test.ml":2071:24 + ├─ Left x + └─x = 4 + 5 + baz = 6 + ├─"test/test_expect_test.ml":2072:31 + ├─ Right Two y + └─y = 3 + 6 + foo = 3 + ├─"test/test_expect_test.ml":2075:10 + └─ + └─"test/test_expect_test.ml":2076:81 + 3 + |}] let%expect_test "%debug_show tuples merge type info" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2095,23 +2119,24 @@ let%expect_test "%debug_show tuples merge type info" = {| BEGIN DEBUG SESSION (r1, r2) - ├─"test/test_expect_test.ml":2090:6 + ├─"test/test_expect_test.ml":2114:6 ├─ │ ├─r1 = 339 │ └─r2 = 109 └─baz = (339, 109) - ├─"test/test_expect_test.ml":2085:21 + ├─"test/test_expect_test.ml":2109:21 ├─first = 7 ├─second = 42 ├─(y, z) - │ ├─"test/test_expect_test.ml":2086:8 + │ ├─"test/test_expect_test.ml":2110:8 │ └─ │ ├─y = 8 │ └─z = 3 └─a = 8 - └─"test/test_expect_test.ml":2087:8 + └─"test/test_expect_test.ml":2111:8 339 - 109 |}] + 109 + |}] let%expect_test "%debug_show decompose multi-argument function type" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2123,13 +2148,14 @@ let%expect_test "%debug_show decompose multi-argument function type" = {| BEGIN DEBUG SESSION f = 7 - ├─"test/test_expect_test.ml":2118:44 + ├─"test/test_expect_test.ml":2143:44 └─b = 6 7 g = 12 - ├─"test/test_expect_test.ml":2119:56 + ├─"test/test_expect_test.ml":2144:56 └─b = 6 - 12 |}] + 12 + |}] let%expect_test "%debug_show debug type info" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2141,17 +2167,18 @@ let%expect_test "%debug_show debug type info" = print_endline @@ Int.to_string @@ g 'a' 6 'b' 'c']]; [%expect {| - BEGIN DEBUG SESSION - f : int = 7 - ├─"test/test_expect_test.ml":2138:37 - ├─f : int - └─b : int = 6 - 7 - g : int = 12 - ├─"test/test_expect_test.ml":2139:49 - ├─g : int - └─b : int = 6 - 12 |}] + BEGIN DEBUG SESSION + f : int = 7 + ├─"test/test_expect_test.ml":2164:37 + ├─f : int + └─b : int = 6 + 7 + g : int = 12 + ├─"test/test_expect_test.ml":2165:49 + ├─g : int + └─b : int = 6 + 12 + |}] let%expect_test "%track_show options values_first_mode" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2167,30 +2194,31 @@ let%expect_test "%track_show options values_first_mode" = let () = print_endline @@ Int.to_string @@ zoo (Some (4, 5)) in [%expect {| - BEGIN DEBUG SESSION - foo = 14 - ├─"test/test_expect_test.ml":2158:21 - └─ Some y - ├─"test/test_expect_test.ml":2159:54 - └─y = 7 - 14 - bar = 14 - ├─"test/test_expect_test.ml":2162:10 - ├─l = (Some 7) - └─ Some y - └─"test/test_expect_test.ml":2162:70 - 14 - baz = 8 - ├─"test/test_expect_test.ml":2164:63 - ├─ Some y - └─y = 4 - 8 - zoo = 9 - ├─"test/test_expect_test.ml":2166:76 - ├─ Some (y, z) - ├─y = 4 - └─z = 5 - 9 |}] + BEGIN DEBUG SESSION + foo = 14 + ├─"test/test_expect_test.ml":2185:21 + └─ Some y + ├─"test/test_expect_test.ml":2186:54 + └─y = 7 + 14 + bar = 14 + ├─"test/test_expect_test.ml":2189:10 + ├─l = (Some 7) + └─ Some y + └─"test/test_expect_test.ml":2189:70 + 14 + baz = 8 + ├─"test/test_expect_test.ml":2191:63 + ├─ Some y + └─y = 4 + 8 + zoo = 9 + ├─"test/test_expect_test.ml":2193:76 + ├─ Some (y, z) + ├─y = 4 + └─z = 5 + 9 + |}] let%expect_test "%track_show list values_first_mode" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2209,36 +2237,37 @@ let%expect_test "%track_show list values_first_mode" = let () = print_endline @@ Int.to_string @@ baz [ 4; 5; 6 ] in [%expect {| - BEGIN DEBUG SESSION - foo = 14 - ├─"test/test_expect_test.ml":2197:21 - └─ :: (y, _) - ├─"test/test_expect_test.ml":2197:77 - └─y = 7 - 14 - bar = 14 - ├─"test/test_expect_test.ml":2199:10 - ├─l = [7] - └─ :: (y, _) - └─"test/test_expect_test.ml":2199:66 - 14 - baz = 8 - ├─"test/test_expect_test.ml":2203:15 - ├─ :: (y, []) - └─y = 4 - 8 - baz = 9 - ├─"test/test_expect_test.ml":2204:18 - ├─ :: (y, :: (z, [])) - ├─y = 4 - └─z = 5 - 9 - baz = 10 - ├─"test/test_expect_test.ml":2205:21 - ├─ :: (y, :: (z, _)) - ├─y = 4 - └─z = 5 - 10 |}] + BEGIN DEBUG SESSION + foo = 14 + ├─"test/test_expect_test.ml":2225:21 + └─ :: (y, _) + ├─"test/test_expect_test.ml":2225:77 + └─y = 7 + 14 + bar = 14 + ├─"test/test_expect_test.ml":2227:10 + ├─l = [7] + └─ :: (y, _) + └─"test/test_expect_test.ml":2227:66 + 14 + baz = 8 + ├─"test/test_expect_test.ml":2231:15 + ├─ :: (y, []) + └─y = 4 + 8 + baz = 9 + ├─"test/test_expect_test.ml":2232:18 + ├─ :: (y, :: (z, [])) + ├─y = 4 + └─z = 5 + 9 + baz = 10 + ├─"test/test_expect_test.ml":2233:21 + ├─ :: (y, :: (z, _)) + ├─y = 4 + └─z = 5 + 10 + |}] let%expect_test "%track_rtb_show list runtime passing" = let%track_this_rtb_show foo l : int = @@ -2270,28 +2299,29 @@ let%expect_test "%track_rtb_show list runtime passing" = in [%expect {| - BEGIN DEBUG SESSION foo-1 - foo = 14 - ├─"test/test_expect_test.ml":2244:30 - └─foo-1 :: (y, _) - ├─"test/test_expect_test.ml":2245:50 - └─y = 7 - 14 + BEGIN DEBUG SESSION foo-1 + foo = 14 + ├─"test/test_expect_test.ml":2273:30 + └─foo-1 :: (y, _) + ├─"test/test_expect_test.ml":2274:50 + └─y = 7 + 14 - BEGIN DEBUG SESSION baz-1 - baz = 8 - ├─"test/test_expect_test.ml":2255:15 - ├─baz-1 :: (y, []) - └─y = 4 - 8 + BEGIN DEBUG SESSION baz-1 + baz = 8 + ├─"test/test_expect_test.ml":2284:15 + ├─baz-1 :: (y, []) + └─y = 4 + 8 - BEGIN DEBUG SESSION baz-2 - baz = 10 - ├─"test/test_expect_test.ml":2257:21 - ├─baz-2 :: (y, :: (z, _)) - ├─y = 4 - └─z = 5 - 10 |}] + BEGIN DEBUG SESSION baz-2 + baz = 10 + ├─"test/test_expect_test.ml":2286:21 + ├─baz-2 :: (y, :: (z, _)) + ├─y = 4 + └─z = 5 + 10 + |}] let%expect_test "%track_rt_show procedure runtime passing" = let%track_this_rt_show bar () = (fun () -> ()) () in @@ -2305,25 +2335,26 @@ let%expect_test "%track_rt_show procedure runtime passing" = let () = foo (Minidebug_runtime.debug_flushing ~global_prefix:"foo-2" ()) () in [%expect {| - BEGIN DEBUG SESSION bar-1 - bar-1 bar begin "test/test_expect_test.ml":2297:29: - bar-1 fun:test_expect_test:2297 begin "test/test_expect_test.ml":2297:34: - bar-1 fun:test_expect_test:2297 end - bar-1 bar end + BEGIN DEBUG SESSION bar-1 + bar-1 bar begin "test/test_expect_test.ml":2327:29: + bar-1 fun:test_expect_test:2327 begin "test/test_expect_test.ml":2327:34: + bar-1 fun:test_expect_test:2327 end + bar-1 bar end - BEGIN DEBUG SESSION bar-2 - bar-2 bar begin "test/test_expect_test.ml":2297:29: - bar-2 fun:test_expect_test:2297 begin "test/test_expect_test.ml":2297:34: - bar-2 fun:test_expect_test:2297 end - bar-2 bar end + BEGIN DEBUG SESSION bar-2 + bar-2 bar begin "test/test_expect_test.ml":2327:29: + bar-2 fun:test_expect_test:2327 begin "test/test_expect_test.ml":2327:34: + bar-2 fun:test_expect_test:2327 end + bar-2 bar end - BEGIN DEBUG SESSION foo-1 - foo-1 foo begin "test/test_expect_test.ml":2300:29: - foo-1 foo end + BEGIN DEBUG SESSION foo-1 + foo-1 foo begin "test/test_expect_test.ml":2330:29: + foo-1 foo end - BEGIN DEBUG SESSION foo-2 - foo-2 foo begin "test/test_expect_test.ml":2300:29: - foo-2 foo end |}] + BEGIN DEBUG SESSION foo-2 + foo-2 foo begin "test/test_expect_test.ml":2330:29: + foo-2 foo end + |}] let%expect_test "%track_rt_show nested procedure runtime passing" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2342,29 +2373,30 @@ let%expect_test "%track_rt_show nested procedure runtime passing" = let () = bar (Minidebug_runtime.debug_flushing ~global_prefix:"bar-2" ()) () in [%expect {| - BEGIN DEBUG SESSION - rt_test - └─"test/test_expect_test.ml":2330:25 + BEGIN DEBUG SESSION + rt_test + └─"test/test_expect_test.ml":2361:25 - BEGIN DEBUG SESSION foo-1 - foo-1 foo begin "test/test_expect_test.ml":2332:26: - foo-1 foo end + BEGIN DEBUG SESSION foo-1 + foo-1 foo begin "test/test_expect_test.ml":2363:26: + foo-1 foo end - BEGIN DEBUG SESSION foo-2 - foo-2 foo begin "test/test_expect_test.ml":2332:26: - foo-2 foo end + BEGIN DEBUG SESSION foo-2 + foo-2 foo begin "test/test_expect_test.ml":2363:26: + foo-2 foo end - BEGIN DEBUG SESSION bar-1 - bar-1 bar begin "test/test_expect_test.ml":2331:26: - bar-1 fun:test_expect_test:2331 begin "test/test_expect_test.ml":2331:31: - bar-1 fun:test_expect_test:2331 end - bar-1 bar end + BEGIN DEBUG SESSION bar-1 + bar-1 bar begin "test/test_expect_test.ml":2362:26: + bar-1 fun:test_expect_test:2362 begin "test/test_expect_test.ml":2362:31: + bar-1 fun:test_expect_test:2362 end + bar-1 bar end - BEGIN DEBUG SESSION bar-2 - bar-2 bar begin "test/test_expect_test.ml":2331:26: - bar-2 fun:test_expect_test:2331 begin "test/test_expect_test.ml":2331:31: - bar-2 fun:test_expect_test:2331 end - bar-2 bar end |}] + BEGIN DEBUG SESSION bar-2 + bar-2 bar begin "test/test_expect_test.ml":2362:26: + bar-2 fun:test_expect_test:2362 begin "test/test_expect_test.ml":2362:31: + bar-2 fun:test_expect_test:2362 end + bar-2 bar end + |}] let%expect_test "%log constant entries" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2383,23 +2415,24 @@ let%expect_test "%log constant entries" = let () = bar () in [%expect {| - BEGIN DEBUG SESSION - foo = () - ├─"test/test_expect_test.ml":2371:21 - ├─"This is the first log line" - ├─["This is the"; "2"; "log line"] - └─("This is the", 3, "or", 3.14, "log line") - bar - ├─"test/test_expect_test.ml":2378:21 - ├─This is the first log line - ├─This is the - │ ├─2 - │ └─log line - └─This is the - ├─3 - ├─or - ├─3.14 - └─log line |}] + BEGIN DEBUG SESSION + foo = () + ├─"test/test_expect_test.ml":2403:21 + ├─"This is the first log line" + ├─["This is the"; "2"; "log line"] + └─("This is the", 3, "or", 3.14, "log line") + bar + ├─"test/test_expect_test.ml":2410:21 + ├─This is the first log line + ├─This is the + │ ├─2 + │ └─log line + └─This is the + ├─3 + ├─or + ├─3.14 + └─log line + |}] let%expect_test "%log with type annotations" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2416,14 +2449,15 @@ let%expect_test "%log with type annotations" = let () = foo () in [%expect {| - BEGIN DEBUG SESSION - foo = () - ├─"test/test_expect_test.ml":2409:21 - ├─("This is like", 3, "or", 3.14, "above") - ├─("tau =", 6.28) - ├─[4; 1; 2; 3] - ├─[3; 1; 2; 3] - └─[3; 1; 2; 3] |}] + BEGIN DEBUG SESSION + foo = () + ├─"test/test_expect_test.ml":2442:21 + ├─("This is like", 3, "or", 3.14, "above") + ├─("tau =", 6.28) + ├─[4; 1; 2; 3] + ├─[3; 1; 2; 3] + └─[3; 1; 2; 3] + |}] let%expect_test "%log with default type assumption" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2443,13 +2477,14 @@ let%expect_test "%log with default type assumption" = let () = foo () in [%expect {| - BEGIN DEBUG SESSION - foo = () - ├─"test/test_expect_test.ml":2434:21 - ├─"2*3" - ├─("This is like", "3", "or", "3.14", "above") - ├─("tau =", "2*3.14") - └─[("2*3", 0); ("1", 1); ("2", 2); ("3", 3)] |}] + BEGIN DEBUG SESSION + foo = () + ├─"test/test_expect_test.ml":2468:21 + ├─"2*3" + ├─("This is like", "3", "or", "3.14", "above") + ├─("tau =", "2*3.14") + └─[("2*3", 0); ("1", 1); ("2", 2); ("3", 3)] + |}] let%expect_test "%log track while-loop" = let module Debug_runtime = (val Minidebug_runtime.debug ()) in @@ -2469,34 +2504,34 @@ let%expect_test "%log track while-loop" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":2456:17: result - └─"test/test_expect_test.ml":2459:4: while:test_expect_test:2459 - ├─"test/test_expect_test.ml":2460:6: + "test/test_expect_test.ml":2491:17: result + └─"test/test_expect_test.ml":2494:4: while:test_expect_test:2494 + ├─"test/test_expect_test.ml":2495:6: │ ├─(1 i= 0) │ ├─(2 i= 1) │ └─(3 j= 1) - ├─"test/test_expect_test.ml":2460:6: + ├─"test/test_expect_test.ml":2495:6: │ ├─(1 i= 1) │ ├─(2 i= 2) │ └─(3 j= 3) - ├─"test/test_expect_test.ml":2460:6: + ├─"test/test_expect_test.ml":2495:6: │ ├─(1 i= 2) │ ├─(2 i= 3) │ └─(3 j= 6) - ├─"test/test_expect_test.ml":2460:6: + ├─"test/test_expect_test.ml":2495:6: │ ├─(1 i= 3) │ ├─(2 i= 4) │ └─(3 j= 10) - ├─"test/test_expect_test.ml":2460:6: + ├─"test/test_expect_test.ml":2495:6: │ ├─(1 i= 4) │ ├─(2 i= 5) │ └─(3 j= 15) - └─"test/test_expect_test.ml":2460:6: + └─"test/test_expect_test.ml":2495:6: ├─(1 i= 5) ├─(2 i= 6) └─(3 j= 21) 21 - |}] + |}] let%expect_test "%log runtime log levels while-loop" = let%track_rtb_sexp result () : int = @@ -2517,177 +2552,207 @@ let%expect_test "%log runtime log levels while-loop" = print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:Nothing + (Minidebug_runtime.debug ~values_first_mode:true ~log_level:0 ~global_prefix:"Nothing" ()) ()); print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:Nonempty_entries + (Minidebug_runtime.debug ~values_first_mode:true ~log_level:1 ~global_prefix:"Nonempty" ()) ()); print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true - ~log_level:(Prefixed [| "ERROR"; "WARN" |]) + (Minidebug_runtime.debug ~values_first_mode:true ~log_level:3 ~global_prefix:"Prefixed" ()) ()); print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true - ~log_level:(Prefixed_or_result [| "ERROR"; "WARN" |]) + (Minidebug_runtime.debug ~values_first_mode:true ~log_level:2 ~global_prefix:"Prefixed_or_result" ()) ()); [%expect {| - BEGIN DEBUG SESSION Everything - "test/test_expect_test.ml":2502:28: Everything result - ├─"test/test_expect_test.ml":2505:4: Everything while:test_expect_test:2505 - │ ├─"test/test_expect_test.ml":2507:6: Everything - │ │ ├─"test/test_expect_test.ml":2507:21: Everything then:test_expect_test:2507 - │ │ │ └─(ERROR: 1 i= 0) - │ │ ├─(WARNING: 2 i= 1) - │ │ ├─"test/test_expect_test.ml":2510:11: Everything fun:test_expect_test:2510 - │ │ └─(INFO: 3 j= 1) - │ ├─"test/test_expect_test.ml":2507:6: Everything - │ │ ├─"test/test_expect_test.ml":2507:21: Everything then:test_expect_test:2507 - │ │ │ └─(ERROR: 1 i= 1) - │ │ ├─(WARNING: 2 i= 2) - │ │ ├─"test/test_expect_test.ml":2510:11: Everything fun:test_expect_test:2510 - │ │ └─(INFO: 3 j= 3) - │ ├─"test/test_expect_test.ml":2507:6: Everything - │ │ ├─"test/test_expect_test.ml":2507:63: Everything else:test_expect_test:2507 - │ │ ├─(WARNING: 2 i= 3) - │ │ ├─"test/test_expect_test.ml":2510:11: Everything fun:test_expect_test:2510 - │ │ └─(INFO: 3 j= 6) - │ ├─"test/test_expect_test.ml":2507:6: Everything - │ │ ├─"test/test_expect_test.ml":2507:63: Everything else:test_expect_test:2507 - │ │ ├─(WARNING: 2 i= 4) - │ │ ├─"test/test_expect_test.ml":2510:11: Everything fun:test_expect_test:2510 - │ │ └─(INFO: 3 j= 10) - │ ├─"test/test_expect_test.ml":2507:6: Everything - │ │ ├─"test/test_expect_test.ml":2507:63: Everything else:test_expect_test:2507 - │ │ ├─(WARNING: 2 i= 5) - │ │ ├─"test/test_expect_test.ml":2510:11: Everything fun:test_expect_test:2510 - │ │ └─(INFO: 3 j= 15) - │ └─"test/test_expect_test.ml":2507:6: Everything - │ ├─"test/test_expect_test.ml":2507:63: Everything else:test_expect_test:2507 - │ ├─(WARNING: 2 i= 6) - │ ├─"test/test_expect_test.ml":2510:11: Everything fun:test_expect_test:2510 - │ └─(INFO: 3 j= 21) - └─result = 21 - 21 - - BEGIN DEBUG SESSION Nothing - 21 - - BEGIN DEBUG SESSION Nonempty - result = 21 - ├─"test/test_expect_test.ml":2502:28 - └─Nonempty while:test_expect_test:2505 - ├─"test/test_expect_test.ml":2505:4 - ├─Nonempty - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─Nonempty then:test_expect_test:2507 - │ │ ├─"test/test_expect_test.ml":2507:21 - │ │ └─(ERROR: 1 i= 0) - │ ├─(WARNING: 2 i= 1) - │ └─(INFO: 3 j= 1) - ├─Nonempty - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─Nonempty then:test_expect_test:2507 - │ │ ├─"test/test_expect_test.ml":2507:21 - │ │ └─(ERROR: 1 i= 1) - │ ├─(WARNING: 2 i= 2) - │ └─(INFO: 3 j= 3) - ├─Nonempty - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─(WARNING: 2 i= 3) - │ └─(INFO: 3 j= 6) - ├─Nonempty - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─(WARNING: 2 i= 4) - │ └─(INFO: 3 j= 10) - ├─Nonempty - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─(WARNING: 2 i= 5) - │ └─(INFO: 3 j= 15) - └─Nonempty - ├─"test/test_expect_test.ml":2507:6 - ├─(WARNING: 2 i= 6) - └─(INFO: 3 j= 21) - 21 - - BEGIN DEBUG SESSION Prefixed - Prefixed result - ├─"test/test_expect_test.ml":2502:28 - └─Prefixed while:test_expect_test:2505 - ├─"test/test_expect_test.ml":2505:4 - ├─Prefixed - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─Prefixed then:test_expect_test:2507 - │ │ ├─"test/test_expect_test.ml":2507:21 - │ │ └─(ERROR: 1 i= 0) - │ └─(WARNING: 2 i= 1) - ├─Prefixed - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─Prefixed then:test_expect_test:2507 - │ │ ├─"test/test_expect_test.ml":2507:21 - │ │ └─(ERROR: 1 i= 1) - │ └─(WARNING: 2 i= 2) - ├─Prefixed - │ ├─"test/test_expect_test.ml":2507:6 - │ └─(WARNING: 2 i= 3) - ├─Prefixed - │ ├─"test/test_expect_test.ml":2507:6 - │ └─(WARNING: 2 i= 4) - ├─Prefixed - │ ├─"test/test_expect_test.ml":2507:6 - │ └─(WARNING: 2 i= 5) - └─Prefixed - ├─"test/test_expect_test.ml":2507:6 - └─(WARNING: 2 i= 6) - 21 - - BEGIN DEBUG SESSION Prefixed_or_result - result = 21 - ├─"test/test_expect_test.ml":2502:28 - └─Prefixed_or_result while:test_expect_test:2505 - ├─"test/test_expect_test.ml":2505:4 - ├─Prefixed_or_result - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─Prefixed_or_result then:test_expect_test:2507 - │ │ ├─"test/test_expect_test.ml":2507:21 - │ │ └─(ERROR: 1 i= 0) - │ └─(WARNING: 2 i= 1) - ├─Prefixed_or_result - │ ├─"test/test_expect_test.ml":2507:6 - │ ├─Prefixed_or_result then:test_expect_test:2507 - │ │ ├─"test/test_expect_test.ml":2507:21 - │ │ └─(ERROR: 1 i= 1) - │ └─(WARNING: 2 i= 2) - ├─Prefixed_or_result - │ ├─"test/test_expect_test.ml":2507:6 - │ └─(WARNING: 2 i= 3) - ├─Prefixed_or_result - │ ├─"test/test_expect_test.ml":2507:6 - │ └─(WARNING: 2 i= 4) - ├─Prefixed_or_result - │ ├─"test/test_expect_test.ml":2507:6 - │ └─(WARNING: 2 i= 5) - └─Prefixed_or_result - ├─"test/test_expect_test.ml":2507:6 - └─(WARNING: 2 i= 6) - 21 - |}] + BEGIN DEBUG SESSION Everything + "test/test_expect_test.ml":2537:28: Everything result + ├─"test/test_expect_test.ml":2540:4: Everything while:test_expect_test:2540 + │ ├─"test/test_expect_test.ml":2542:6: Everything + │ │ ├─"test/test_expect_test.ml":2542:21: Everything then:test_expect_test:2542 + │ │ │ └─(ERROR: 1 i= 0) + │ │ ├─(WARNING: 2 i= 1) + │ │ ├─"test/test_expect_test.ml":2545:11: Everything fun:test_expect_test:2545 + │ │ └─(INFO: 3 j= 1) + │ ├─"test/test_expect_test.ml":2542:6: Everything + │ │ ├─"test/test_expect_test.ml":2542:21: Everything then:test_expect_test:2542 + │ │ │ └─(ERROR: 1 i= 1) + │ │ ├─(WARNING: 2 i= 2) + │ │ ├─"test/test_expect_test.ml":2545:11: Everything fun:test_expect_test:2545 + │ │ └─(INFO: 3 j= 3) + │ ├─"test/test_expect_test.ml":2542:6: Everything + │ │ ├─"test/test_expect_test.ml":2542:63: Everything else:test_expect_test:2542 + │ │ ├─(WARNING: 2 i= 3) + │ │ ├─"test/test_expect_test.ml":2545:11: Everything fun:test_expect_test:2545 + │ │ └─(INFO: 3 j= 6) + │ ├─"test/test_expect_test.ml":2542:6: Everything + │ │ ├─"test/test_expect_test.ml":2542:63: Everything else:test_expect_test:2542 + │ │ ├─(WARNING: 2 i= 4) + │ │ ├─"test/test_expect_test.ml":2545:11: Everything fun:test_expect_test:2545 + │ │ └─(INFO: 3 j= 10) + │ ├─"test/test_expect_test.ml":2542:6: Everything + │ │ ├─"test/test_expect_test.ml":2542:63: Everything else:test_expect_test:2542 + │ │ ├─(WARNING: 2 i= 5) + │ │ ├─"test/test_expect_test.ml":2545:11: Everything fun:test_expect_test:2545 + │ │ └─(INFO: 3 j= 15) + │ └─"test/test_expect_test.ml":2542:6: Everything + │ ├─"test/test_expect_test.ml":2542:63: Everything else:test_expect_test:2542 + │ ├─(WARNING: 2 i= 6) + │ ├─"test/test_expect_test.ml":2545:11: Everything fun:test_expect_test:2545 + │ └─(INFO: 3 j= 21) + └─result = 21 + 21 + + BEGIN DEBUG SESSION Nothing + 21 + + BEGIN DEBUG SESSION Nonempty + result = 21 + ├─"test/test_expect_test.ml":2537:28 + └─Nonempty while:test_expect_test:2540 + ├─"test/test_expect_test.ml":2540:4 + ├─Nonempty + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Nonempty then:test_expect_test:2542 + │ │ ├─"test/test_expect_test.ml":2542:21 + │ │ └─(ERROR: 1 i= 0) + │ ├─(WARNING: 2 i= 1) + │ └─(INFO: 3 j= 1) + ├─Nonempty + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Nonempty then:test_expect_test:2542 + │ │ ├─"test/test_expect_test.ml":2542:21 + │ │ └─(ERROR: 1 i= 1) + │ ├─(WARNING: 2 i= 2) + │ └─(INFO: 3 j= 3) + ├─Nonempty + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─(WARNING: 2 i= 3) + │ └─(INFO: 3 j= 6) + ├─Nonempty + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─(WARNING: 2 i= 4) + │ └─(INFO: 3 j= 10) + ├─Nonempty + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─(WARNING: 2 i= 5) + │ └─(INFO: 3 j= 15) + └─Nonempty + ├─"test/test_expect_test.ml":2542:6 + ├─(WARNING: 2 i= 6) + └─(INFO: 3 j= 21) + 21 + + BEGIN DEBUG SESSION Prefixed + result = 21 + ├─"test/test_expect_test.ml":2537:28 + └─Prefixed while:test_expect_test:2540 + ├─"test/test_expect_test.ml":2540:4 + ├─Prefixed + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed then:test_expect_test:2542 + │ │ ├─"test/test_expect_test.ml":2542:21 + │ │ └─(ERROR: 1 i= 0) + │ ├─(WARNING: 2 i= 1) + │ ├─Prefixed fun:test_expect_test:2545 + │ │ └─"test/test_expect_test.ml":2545:11 + │ └─(INFO: 3 j= 1) + ├─Prefixed + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed then:test_expect_test:2542 + │ │ ├─"test/test_expect_test.ml":2542:21 + │ │ └─(ERROR: 1 i= 1) + │ ├─(WARNING: 2 i= 2) + │ ├─Prefixed fun:test_expect_test:2545 + │ │ └─"test/test_expect_test.ml":2545:11 + │ └─(INFO: 3 j= 3) + ├─Prefixed + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed else:test_expect_test:2542 + │ │ └─"test/test_expect_test.ml":2542:63 + │ ├─(WARNING: 2 i= 3) + │ ├─Prefixed fun:test_expect_test:2545 + │ │ └─"test/test_expect_test.ml":2545:11 + │ └─(INFO: 3 j= 6) + ├─Prefixed + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed else:test_expect_test:2542 + │ │ └─"test/test_expect_test.ml":2542:63 + │ ├─(WARNING: 2 i= 4) + │ ├─Prefixed fun:test_expect_test:2545 + │ │ └─"test/test_expect_test.ml":2545:11 + │ └─(INFO: 3 j= 10) + ├─Prefixed + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed else:test_expect_test:2542 + │ │ └─"test/test_expect_test.ml":2542:63 + │ ├─(WARNING: 2 i= 5) + │ ├─Prefixed fun:test_expect_test:2545 + │ │ └─"test/test_expect_test.ml":2545:11 + │ └─(INFO: 3 j= 15) + └─Prefixed + ├─"test/test_expect_test.ml":2542:6 + ├─Prefixed else:test_expect_test:2542 + │ └─"test/test_expect_test.ml":2542:63 + ├─(WARNING: 2 i= 6) + ├─Prefixed fun:test_expect_test:2545 + │ └─"test/test_expect_test.ml":2545:11 + └─(INFO: 3 j= 21) + 21 + + BEGIN DEBUG SESSION Prefixed_or_result + result = 21 + ├─"test/test_expect_test.ml":2537:28 + └─Prefixed_or_result while:test_expect_test:2540 + ├─"test/test_expect_test.ml":2540:4 + ├─Prefixed_or_result + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed_or_result then:test_expect_test:2542 + │ │ ├─"test/test_expect_test.ml":2542:21 + │ │ └─(ERROR: 1 i= 0) + │ ├─(WARNING: 2 i= 1) + │ └─(INFO: 3 j= 1) + ├─Prefixed_or_result + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─Prefixed_or_result then:test_expect_test:2542 + │ │ ├─"test/test_expect_test.ml":2542:21 + │ │ └─(ERROR: 1 i= 1) + │ ├─(WARNING: 2 i= 2) + │ └─(INFO: 3 j= 3) + ├─Prefixed_or_result + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─(WARNING: 2 i= 3) + │ └─(INFO: 3 j= 6) + ├─Prefixed_or_result + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─(WARNING: 2 i= 4) + │ └─(INFO: 3 j= 10) + ├─Prefixed_or_result + │ ├─"test/test_expect_test.ml":2542:6 + │ ├─(WARNING: 2 i= 5) + │ └─(INFO: 3 j= 15) + └─Prefixed_or_result + ├─"test/test_expect_test.ml":2542:6 + ├─(WARNING: 2 i= 6) + └─(INFO: 3 j= 21) + 21 + |}] let%expect_test "%log compile time log levels while-loop" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in let%track_sexp everything () : int = [%log_level - Everything; + 9; let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -2703,7 +2768,7 @@ let%expect_test "%log compile time log levels while-loop" = let%track_sexp nothing () : int = (* The result is still logged, because the binding is outside of %log_level. *) [%log_level - Nothing; + 0; let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -2718,16 +2783,16 @@ let%expect_test "%log compile time log levels while-loop" = in let%track_sexp prefixed () : int = [%log_level - Prefixed_or_result [| "WARN"; "ERROR" |]; + 2; let i = ref 0 in let j = ref 0 in while !i < 6 do (* Intentional empty but not omitted else-branch. *) - if !i < 2 then [%log "ERROR:", 1, "i=", (!i : int)] else (); + if !i < 2 then [%log1 "ERROR:", 1, "i=", (!i : int)] else (); incr i; - [%log "WARNING:", 2, "i=", (!i : int)]; + [%log2 "WARNING:", 2, "i=", (!i : int)]; j := (fun { contents } -> !j + contents) i; - [%log "INFO:", 3, "j=", (!j : int)] + [%log3 "INFO:", 3, "j=", (!j : int)] done; !j] in @@ -2736,95 +2801,103 @@ let%expect_test "%log compile time log levels while-loop" = print_endline @@ Int.to_string @@ prefixed (); [%expect {| - BEGIN DEBUG SESSION - everything = 21 - ├─"test/test_expect_test.ml":2688:28 - └─while:test_expect_test:2693 - ├─"test/test_expect_test.ml":2693:6 - ├─ - │ ├─"test/test_expect_test.ml":2695:8 - │ ├─then:test_expect_test:2695 - │ │ ├─"test/test_expect_test.ml":2695:23 - │ │ └─(ERROR: 1 i= 0) - │ ├─(WARNING: 2 i= 1) - │ ├─fun:test_expect_test:2698 - │ │ └─"test/test_expect_test.ml":2698:13 - │ └─(INFO: 3 j= 1) - ├─ - │ ├─"test/test_expect_test.ml":2695:8 - │ ├─then:test_expect_test:2695 - │ │ ├─"test/test_expect_test.ml":2695:23 - │ │ └─(ERROR: 1 i= 1) - │ ├─(WARNING: 2 i= 2) - │ ├─fun:test_expect_test:2698 - │ │ └─"test/test_expect_test.ml":2698:13 - │ └─(INFO: 3 j= 3) - ├─ - │ ├─"test/test_expect_test.ml":2695:8 - │ ├─else:test_expect_test:2695 - │ │ └─"test/test_expect_test.ml":2695:65 - │ ├─(WARNING: 2 i= 3) - │ ├─fun:test_expect_test:2698 - │ │ └─"test/test_expect_test.ml":2698:13 - │ └─(INFO: 3 j= 6) - ├─ - │ ├─"test/test_expect_test.ml":2695:8 - │ ├─else:test_expect_test:2695 - │ │ └─"test/test_expect_test.ml":2695:65 - │ ├─(WARNING: 2 i= 4) - │ ├─fun:test_expect_test:2698 - │ │ └─"test/test_expect_test.ml":2698:13 - │ └─(INFO: 3 j= 10) - ├─ - │ ├─"test/test_expect_test.ml":2695:8 - │ ├─else:test_expect_test:2695 - │ │ └─"test/test_expect_test.ml":2695:65 - │ ├─(WARNING: 2 i= 5) - │ ├─fun:test_expect_test:2698 - │ │ └─"test/test_expect_test.ml":2698:13 - │ └─(INFO: 3 j= 15) - └─ - ├─"test/test_expect_test.ml":2695:8 - ├─else:test_expect_test:2695 - │ └─"test/test_expect_test.ml":2695:65 - ├─(WARNING: 2 i= 6) - ├─fun:test_expect_test:2698 - │ └─"test/test_expect_test.ml":2698:13 - └─(INFO: 3 j= 21) - 21 - nothing = 21 - └─"test/test_expect_test.ml":2703:25 - 21 - prefixed = 21 - ├─"test/test_expect_test.ml":2719:26 - └─while:test_expect_test:2724 - ├─"test/test_expect_test.ml":2724:6 - ├─ - │ ├─"test/test_expect_test.ml":2726:8 - │ ├─then:test_expect_test:2726 - │ │ ├─"test/test_expect_test.ml":2726:23 - │ │ └─(ERROR: 1 i= 0) - │ └─(WARNING: 2 i= 1) - ├─ - │ ├─"test/test_expect_test.ml":2726:8 - │ ├─then:test_expect_test:2726 - │ │ ├─"test/test_expect_test.ml":2726:23 - │ │ └─(ERROR: 1 i= 1) - │ └─(WARNING: 2 i= 2) - ├─ - │ ├─"test/test_expect_test.ml":2726:8 - │ └─(WARNING: 2 i= 3) - ├─ - │ ├─"test/test_expect_test.ml":2726:8 - │ └─(WARNING: 2 i= 4) - ├─ - │ ├─"test/test_expect_test.ml":2726:8 - │ └─(WARNING: 2 i= 5) - └─ - ├─"test/test_expect_test.ml":2726:8 - └─(WARNING: 2 i= 6) - 21 - |}] + BEGIN DEBUG SESSION + everything = 21 + ├─"test/test_expect_test.ml":2753:28 + └─while:test_expect_test:2758 + ├─"test/test_expect_test.ml":2758:6 + ├─ + │ ├─"test/test_expect_test.ml":2760:8 + │ ├─then:test_expect_test:2760 + │ │ ├─"test/test_expect_test.ml":2760:23 + │ │ └─(ERROR: 1 i= 0) + │ ├─(WARNING: 2 i= 1) + │ ├─fun:test_expect_test:2763 + │ │ └─"test/test_expect_test.ml":2763:13 + │ └─(INFO: 3 j= 1) + ├─ + │ ├─"test/test_expect_test.ml":2760:8 + │ ├─then:test_expect_test:2760 + │ │ ├─"test/test_expect_test.ml":2760:23 + │ │ └─(ERROR: 1 i= 1) + │ ├─(WARNING: 2 i= 2) + │ ├─fun:test_expect_test:2763 + │ │ └─"test/test_expect_test.ml":2763:13 + │ └─(INFO: 3 j= 3) + ├─ + │ ├─"test/test_expect_test.ml":2760:8 + │ ├─else:test_expect_test:2760 + │ │ └─"test/test_expect_test.ml":2760:65 + │ ├─(WARNING: 2 i= 3) + │ ├─fun:test_expect_test:2763 + │ │ └─"test/test_expect_test.ml":2763:13 + │ └─(INFO: 3 j= 6) + ├─ + │ ├─"test/test_expect_test.ml":2760:8 + │ ├─else:test_expect_test:2760 + │ │ └─"test/test_expect_test.ml":2760:65 + │ ├─(WARNING: 2 i= 4) + │ ├─fun:test_expect_test:2763 + │ │ └─"test/test_expect_test.ml":2763:13 + │ └─(INFO: 3 j= 10) + ├─ + │ ├─"test/test_expect_test.ml":2760:8 + │ ├─else:test_expect_test:2760 + │ │ └─"test/test_expect_test.ml":2760:65 + │ ├─(WARNING: 2 i= 5) + │ ├─fun:test_expect_test:2763 + │ │ └─"test/test_expect_test.ml":2763:13 + │ └─(INFO: 3 j= 15) + └─ + ├─"test/test_expect_test.ml":2760:8 + ├─else:test_expect_test:2760 + │ └─"test/test_expect_test.ml":2760:65 + ├─(WARNING: 2 i= 6) + ├─fun:test_expect_test:2763 + │ └─"test/test_expect_test.ml":2763:13 + └─(INFO: 3 j= 21) + 21 + nothing = 21 + └─"test/test_expect_test.ml":2768:25 + 21 + prefixed = 21 + ├─"test/test_expect_test.ml":2784:26 + └─while:test_expect_test:2789 + ├─"test/test_expect_test.ml":2789:6 + ├─ + │ ├─"test/test_expect_test.ml":2791:8 + │ ├─then:test_expect_test:2791 + │ │ ├─"test/test_expect_test.ml":2791:23 + │ │ └─(ERROR: 1 i= 0) + │ └─(WARNING: 2 i= 1) + ├─ + │ ├─"test/test_expect_test.ml":2791:8 + │ ├─then:test_expect_test:2791 + │ │ ├─"test/test_expect_test.ml":2791:23 + │ │ └─(ERROR: 1 i= 1) + │ └─(WARNING: 2 i= 2) + ├─ + │ ├─"test/test_expect_test.ml":2791:8 + │ ├─else:test_expect_test:2791 + │ │ └─"test/test_expect_test.ml":2791:66 + │ └─(WARNING: 2 i= 3) + ├─ + │ ├─"test/test_expect_test.ml":2791:8 + │ ├─else:test_expect_test:2791 + │ │ └─"test/test_expect_test.ml":2791:66 + │ └─(WARNING: 2 i= 4) + ├─ + │ ├─"test/test_expect_test.ml":2791:8 + │ ├─else:test_expect_test:2791 + │ │ └─"test/test_expect_test.ml":2791:66 + │ └─(WARNING: 2 i= 5) + └─ + ├─"test/test_expect_test.ml":2791:8 + ├─else:test_expect_test:2791 + │ └─"test/test_expect_test.ml":2791:66 + └─(WARNING: 2 i= 6) + 21 + |}] let%expect_test "%log compile time log levels runtime-passing while-loop" = let module Debug_runtime = @@ -2832,7 +2905,7 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = in let%debug_sexp () = ([%log_level - Nothing; + 0; let%track_rtb_sexp nothing () : int = let i = ref 0 in let j = ref 0 in @@ -2851,17 +2924,17 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = (Minidebug_runtime.debug ~global_prefix:"nothing" ~values_first_mode:true ()) ()]); [%log_level - Prefixed_or_result [| "WARN"; "ERROR" |]; + 2; let%track_rtb_sexp prefixed () : int = let i = ref 0 in let j = ref 0 in while !i < 6 do (* Intentional empty but not omitted else-branch. *) - if !i < 2 then [%log "ERROR:", 1, "i=", (!i : int)] else (); + if !i < 2 then [%log1 "ERROR:", 1, "i=", (!i : int)] else (); incr i; - [%log "WARNING:", 2, "i=", (!i : int)]; + [%log2 "WARNING:", 2, "i=", (!i : int)]; j := (fun { contents } -> !j + contents) i; - [%log "INFO:", 3, "j=", (!j : int)] + [%log3 "INFO:", 3, "j=", (!j : int)] done; !j in @@ -2872,44 +2945,52 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = in [%expect {| - BEGIN DEBUG SESSION TOPLEVEL - - BEGIN DEBUG SESSION nothing - 21 - - BEGIN DEBUG SESSION prefixed - prefixed = 21 - ├─"test/test_expect_test.ml":2855:34 - └─prefixed while:test_expect_test:2858 - ├─"test/test_expect_test.ml":2858:8 - ├─prefixed - │ ├─"test/test_expect_test.ml":2860:10 - │ ├─prefixed then:test_expect_test:2860 - │ │ ├─"test/test_expect_test.ml":2860:25 - │ │ └─(ERROR: 1 i= 0) - │ └─(WARNING: 2 i= 1) - ├─prefixed - │ ├─"test/test_expect_test.ml":2860:10 - │ ├─prefixed then:test_expect_test:2860 - │ │ ├─"test/test_expect_test.ml":2860:25 - │ │ └─(ERROR: 1 i= 1) - │ └─(WARNING: 2 i= 2) - ├─prefixed - │ ├─"test/test_expect_test.ml":2860:10 - │ └─(WARNING: 2 i= 3) - ├─prefixed - │ ├─"test/test_expect_test.ml":2860:10 - │ └─(WARNING: 2 i= 4) - ├─prefixed - │ ├─"test/test_expect_test.ml":2860:10 - │ └─(WARNING: 2 i= 5) - └─prefixed - ├─"test/test_expect_test.ml":2860:10 - └─(WARNING: 2 i= 6) - 21 - TOPLEVEL () - └─"test/test_expect_test.ml":2833:17 - |}] + BEGIN DEBUG SESSION TOPLEVEL + + BEGIN DEBUG SESSION nothing + 21 + + BEGIN DEBUG SESSION prefixed + prefixed = 21 + ├─"test/test_expect_test.ml":2928:34 + └─prefixed while:test_expect_test:2931 + ├─"test/test_expect_test.ml":2931:8 + ├─prefixed + │ ├─"test/test_expect_test.ml":2933:10 + │ ├─prefixed then:test_expect_test:2933 + │ │ ├─"test/test_expect_test.ml":2933:25 + │ │ └─(ERROR: 1 i= 0) + │ └─(WARNING: 2 i= 1) + ├─prefixed + │ ├─"test/test_expect_test.ml":2933:10 + │ ├─prefixed then:test_expect_test:2933 + │ │ ├─"test/test_expect_test.ml":2933:25 + │ │ └─(ERROR: 1 i= 1) + │ └─(WARNING: 2 i= 2) + ├─prefixed + │ ├─"test/test_expect_test.ml":2933:10 + │ ├─prefixed else:test_expect_test:2933 + │ │ └─"test/test_expect_test.ml":2933:68 + │ └─(WARNING: 2 i= 3) + ├─prefixed + │ ├─"test/test_expect_test.ml":2933:10 + │ ├─prefixed else:test_expect_test:2933 + │ │ └─"test/test_expect_test.ml":2933:68 + │ └─(WARNING: 2 i= 4) + ├─prefixed + │ ├─"test/test_expect_test.ml":2933:10 + │ ├─prefixed else:test_expect_test:2933 + │ │ └─"test/test_expect_test.ml":2933:68 + │ └─(WARNING: 2 i= 5) + └─prefixed + ├─"test/test_expect_test.ml":2933:10 + ├─prefixed else:test_expect_test:2933 + │ └─"test/test_expect_test.ml":2933:68 + └─(WARNING: 2 i= 6) + 21 + TOPLEVEL () + └─"test/test_expect_test.ml":2906:17 + |}] let%expect_test "%log track while-loop result" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in @@ -2931,49 +3012,50 @@ let%expect_test "%log track while-loop result" = {| BEGIN DEBUG SESSION 21 - ├─"test/test_expect_test.ml":2916:17 - └─while:test_expect_test:2919 - ├─"test/test_expect_test.ml":2919:4 + ├─"test/test_expect_test.ml":2997:17 + └─while:test_expect_test:3000 + ├─"test/test_expect_test.ml":3000:4 ├─(3 j= 1) - │ ├─"test/test_expect_test.ml":2920:6 + │ ├─"test/test_expect_test.ml":3001:6 │ ├─ │ ├─(1 i= 0) │ └─(2 i= 1) ├─(3 j= 3) - │ ├─"test/test_expect_test.ml":2920:6 + │ ├─"test/test_expect_test.ml":3001:6 │ ├─ │ ├─(1 i= 1) │ └─(2 i= 2) ├─(3 j= 6) - │ ├─"test/test_expect_test.ml":2920:6 + │ ├─"test/test_expect_test.ml":3001:6 │ ├─ │ ├─(1 i= 2) │ └─(2 i= 3) ├─(3 j= 10) - │ ├─"test/test_expect_test.ml":2920:6 + │ ├─"test/test_expect_test.ml":3001:6 │ ├─ │ ├─(1 i= 3) │ └─(2 i= 4) ├─(3 j= 15) - │ ├─"test/test_expect_test.ml":2920:6 + │ ├─"test/test_expect_test.ml":3001:6 │ ├─ │ ├─(1 i= 4) │ └─(2 i= 5) └─(3 j= 21) - ├─"test/test_expect_test.ml":2920:6 + ├─"test/test_expect_test.ml":3001:6 ├─ ├─(1 i= 5) └─(2 i= 6) 21 - |}] + |}] let%expect_test "%log without scope" = let module Debug_runtime = (val Minidebug_runtime.debug ~print_entry_ids:true ()) in let i = 3 in let pi = 3.14 in let l = [ 1; 2; 3 ] in - (* Orphaned logs are often prevented by the typechecker complaining about missing __entry_id. - But they can happen with closures and other complex ways to interleave uses of a runtime. *) + (* Orphaned logs are often prevented by the typechecker complaining about missing + __entry_id. But they can happen with closures and other complex ways to interleave + uses of a runtime. *) let foo = ref @@ fun () -> () in let%debug_show _bar : unit = foo := @@ -2987,19 +3069,20 @@ let%expect_test "%log without scope" = let () = !foo () in [%expect {| - BEGIN DEBUG SESSION - "test/test_expect_test.ml":2978:17: _bar {#1} - └─_bar = () - {orphaned from #1} - └─("This is like", 3, "or", 3.14, "above") - {orphaned from #1} - └─("tau =", 6.28) - {orphaned from #1} - └─[4; 1; 2; 3] - {orphaned from #1} - └─[3; 1; 2; 3] - {orphaned from #1} - └─[3; 1; 2; 3] |}] + BEGIN DEBUG SESSION + "test/test_expect_test.ml":3060:17: _bar {#1} + └─_bar = () + {orphaned from #1} + └─("This is like", 3, "or", 3.14, "above") + {orphaned from #1} + └─("tau =", 6.28) + {orphaned from #1} + └─[4; 1; 2; 3] + {orphaned from #1} + └─[3; 1; 2; 3] + {orphaned from #1} + └─[3; 1; 2; 3] + |}] let%expect_test "%log without scope values_first_mode" = let module Debug_runtime = @@ -3021,19 +3104,20 @@ let%expect_test "%log without scope values_first_mode" = let () = !foo () in [%expect {| - BEGIN DEBUG SESSION - _bar = () - └─"test/test_expect_test.ml":3012:17 {#1} - ("This is like", 3, "or", 3.14, "above") - └─{orphaned from #1} - ("tau =", 6.28) - └─{orphaned from #1} - [4; 1; 2; 3] - └─{orphaned from #1} - [3; 1; 2; 3] - └─{orphaned from #1} - [3; 1; 2; 3] - └─{orphaned from #1} |}] + BEGIN DEBUG SESSION + _bar = () + └─"test/test_expect_test.ml":3095:17 {#1} + ("This is like", 3, "or", 3.14, "above") + └─{orphaned from #1} + ("tau =", 6.28) + └─{orphaned from #1} + [4; 1; 2; 3] + └─{orphaned from #1} + [3; 1; 2; 3] + └─{orphaned from #1} + [3; 1; 2; 3] + └─{orphaned from #1} + |}] let%expect_test "%log with print_entry_ids, mixed up scopes" = let module Debug_runtime = @@ -3068,33 +3152,36 @@ let%expect_test "%log with print_entry_ids, mixed up scopes" = let () = !foo2 () in [%expect {| - BEGIN DEBUG SESSION - bar = () - └─"test/test_expect_test.ml":3048:21 {#1} - baz = () - └─"test/test_expect_test.ml":3055:21 {#2} - bar = () - └─"test/test_expect_test.ml":3048:21 {#3} - _foobar = () - ├─"test/test_expect_test.ml":3067:17 {#4} - ├─("This is like", 3, "or", 3.14, "above") - ├─("tau =", 6.28) - ├─[3; 1; 2; 3] - ├─[3; 1; 2; 3] - ├─("This is like", 3, "or", 3.14, "above") - └─("tau =", 6.28) - [3; 1; 2; 3] - └─{orphaned from #2} - [3; 1; 2; 3] - └─{orphaned from #2} - ("This is like", 3, "or", 3.14, "above") - └─{orphaned from #1} - ("tau =", 6.28) - └─{orphaned from #1} |}] - -let%expect_test "%log with print_entry_ids, verbose_entry_ids in HTML, values_first_mode" = + BEGIN DEBUG SESSION + bar = () + └─"test/test_expect_test.ml":3132:21 {#1} + baz = () + └─"test/test_expect_test.ml":3139:21 {#2} + bar = () + └─"test/test_expect_test.ml":3132:21 {#3} + _foobar = () + ├─"test/test_expect_test.ml":3151:17 {#4} + ├─("This is like", 3, "or", 3.14, "above") + ├─("tau =", 6.28) + ├─[3; 1; 2; 3] + ├─[3; 1; 2; 3] + ├─("This is like", 3, "or", 3.14, "above") + └─("tau =", 6.28) + [3; 1; 2; 3] + └─{orphaned from #2} + [3; 1; 2; 3] + └─{orphaned from #2} + ("This is like", 3, "or", 3.14, "above") + └─{orphaned from #1} + ("tau =", 6.28) + └─{orphaned from #1} + |}] + +let%expect_test "%log with print_entry_ids, verbose_entry_ids in HTML, values_first_mode" + = let module Debug_runtime = - (val Minidebug_runtime.debug ~print_entry_ids:true ~verbose_entry_ids:true ~values_first_mode:true ()) + (val Minidebug_runtime.debug ~print_entry_ids:true ~verbose_entry_ids:true + ~values_first_mode:true ()) in Debug_runtime.config.backend <- `Html PrintBox_html.Config.default; let i = 3 in @@ -3127,13 +3214,13 @@ let%expect_test "%log with print_entry_ids, verbose_entry_ids in HTML, values_fi [%expect {| BEGIN DEBUG SESSION -
{#1} bar = ()
  • "test/test_expect_test.ml":3106:21
+
{#1} bar = ()
  • "test/test_expect_test.ml":3193:21
-
{#2} baz = ()
  • "test/test_expect_test.ml":3113:21
+
{#2} baz = ()
  • "test/test_expect_test.ml":3200:21
-
{#3} bar = ()
  • "test/test_expect_test.ml":3106:21
+
{#3} bar = ()
  • "test/test_expect_test.ml":3193:21
-
{#4} _foobar = ()
  • "test/test_expect_test.ml":3125:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
+
{#4} _foobar = ()
  • "test/test_expect_test.ml":3212:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
{#2} [3; 1; 2; 3]
  • {orphaned from #2}
@@ -3168,7 +3255,7 @@ let%expect_test "%diagn_show ignores type annots" = 336 109 toplevel - ├─"test/test_expect_test.ml":3149:17 + ├─"test/test_expect_test.ml":3236:17 ├─("for bar, b-3", 42) └─("for baz, f squared", 64) |}] @@ -3194,16 +3281,16 @@ let%expect_test "%diagn_show ignores non-empty bindings" = {| BEGIN DEBUG SESSION bar - ├─"test/test_expect_test.ml":3178:21 + ├─"test/test_expect_test.ml":3265:21 └─("for bar, b-3", 42) 336 baz - ├─"test/test_expect_test.ml":3185:21 + ├─"test/test_expect_test.ml":3272:21 └─("foo baz, f squared", 49) 91 |}] -let%expect_test "%diagn_show no logs" = +let%expect_test "%diagn_show no logs FIXME" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in let%diagn_show bar { first : int; second : int } : int = let { first : int = a; second : int = b } = { first; second = second + 3 } in @@ -3217,15 +3304,20 @@ let%expect_test "%diagn_show no logs" = in let () = print_endline @@ Int.to_string @@ baz { first = 7; second = 42 } in [%expect {| - BEGIN DEBUG SESSION - 336 - 91 |}] + BEGIN DEBUG SESSION + bar + └─"test/test_expect_test.ml":3295:21 + 336 + baz + └─"test/test_expect_test.ml":3301:21 + 91 + |}] -let%expect_test "%debug_show log level Prefixed_or_result [||]" = +let%expect_test "%debug_show log level TODO" = let module Debug_runtime = (val Minidebug_runtime.debug ~values_first_mode:true ()) in let%debug_show () = [%log_level - Prefixed_or_result [||]; + 2; let bar { first : int; second : int } : int = let { first : int = a; second : int = b } = { first; second = second + 3 } in let y : int = a + 1 in @@ -3246,60 +3338,38 @@ let%expect_test "%debug_show log level Prefixed_or_result [||]" = 336 109 () - ├─"test/test_expect_test.ml":3226:17 + ├─"test/test_expect_test.ml":3318:17 ├─bar = 336 - │ ├─"test/test_expect_test.ml":3229:14 + │ ├─"test/test_expect_test.ml":3321:14 + │ ├─first = 7 + │ ├─second = 42 │ ├─{first=a; second=b} - │ │ ├─"test/test_expect_test.ml":3230:12 + │ │ ├─"test/test_expect_test.ml":3322:12 │ │ └─ │ │ ├─a = 7 │ │ └─b = 45 │ ├─y = 8 - │ │ └─"test/test_expect_test.ml":3231:12 + │ │ └─"test/test_expect_test.ml":3323:12 │ └─("for bar, b-3", 42) └─baz = 109 - ├─"test/test_expect_test.ml":3235:14 + ├─"test/test_expect_test.ml":3327:14 + ├─first = 7 + ├─second = 42 ├─{first; second} - │ ├─"test/test_expect_test.ml":3236:12 + │ ├─"test/test_expect_test.ml":3328:12 │ └─ │ ├─first = 8 │ └─second = 45 └─("for baz, f squared", 64) |}] -(* Compare to: - {| - BEGIN DEBUG SESSION - bar = 336 - ├─"test/test_expect_test.ml":1898:21-1901:15 - ├─first = 7 - ├─second = 42 - ├─{first=a; second=b} - │ ├─"test/test_expect_test.ml":1899:8 - │ └─ - │ ├─a = 7 - │ └─b = 45 - └─y = 8 - └─"test/test_expect_test.ml":1900:8 - 336 - baz = 109 - ├─"test/test_expect_test.ml":1904:10-1906:28 - ├─first = 7 - ├─second = 42 - └─{first; second} - ├─"test/test_expect_test.ml":1905:8 - └─ - ├─first = 8 - └─second = 45 - 109 |} *) -let%expect_test "%debug_show log level Prefixed_or_result [||] compile+runtime" = +let%expect_test "%debug_show log level TODO compile+runtime" = let module Debug_runtime = - (val Minidebug_runtime.debug ~values_first_mode:true - ~log_level:(Prefixed_or_result [||]) ()) + (val Minidebug_runtime.debug ~values_first_mode:true ~log_level:3 ()) in let%debug_show () = [%log_level - Prefixed_or_result [||]; + 2; let bar { first : int; second : int } : int = let { first : int = a; second : int = b } = { first; second = second + 3 } in let y : int = a + 1 in @@ -3320,12 +3390,28 @@ let%expect_test "%debug_show log level Prefixed_or_result [||] compile+runtime" 336 109 () - ├─"test/test_expect_test.ml":3300:17 + ├─"test/test_expect_test.ml":3370:17 ├─bar = 336 - │ ├─"test/test_expect_test.ml":3303:14 + │ ├─"test/test_expect_test.ml":3373:14 + │ ├─first = 7 + │ ├─second = 42 + │ ├─{first=a; second=b} + │ │ ├─"test/test_expect_test.ml":3374:12 + │ │ └─ + │ │ ├─a = 7 + │ │ └─b = 45 + │ ├─y = 8 + │ │ └─"test/test_expect_test.ml":3375:12 │ └─("for bar, b-3", 42) └─baz = 109 - ├─"test/test_expect_test.ml":3309:14 + ├─"test/test_expect_test.ml":3379:14 + ├─first = 7 + ├─second = 42 + ├─{first; second} + │ ├─"test/test_expect_test.ml":3380:12 + │ └─ + │ ├─first = 8 + │ └─second = 45 └─("for baz, f squared", 64) |}] @@ -3341,82 +3427,81 @@ let%expect_test "%debug_this_show PrintBox snapshot" = {| BEGIN DEBUG SESSION loop_highlight - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 7 └─z = 3 - └─"test/test_expect_test.ml":3335:8 + └─"test/test_expect_test.ml":3421:8 loop_highlight - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 7 ├─z = 3 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 6 ├─z = 2 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 5 ├─z = 2 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 4 ├─z = 1 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 3 └─z = 1 - └─"test/test_expect_test.ml":3335:8 + └─"test/test_expect_test.ml":3421:8 loop_highlight = 9 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 7 ├─z = 3 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 6 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 6 ├─z = 2 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 4 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 5 ├─z = 2 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 2 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 4 ├─z = 1 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 1 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 3 ├─z = 1 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 2 ├─z = 0 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 1 ├─z = 0 - │ └─"test/test_expect_test.ml":3335:8 + │ └─"test/test_expect_test.ml":3421:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":3334:41 + ├─"test/test_expect_test.ml":3420:41 ├─x = 0 └─z = 0 - └─"test/test_expect_test.ml":3335:8 + └─"test/test_expect_test.ml":3421:8 9 |}] let%expect_test "%track_show don't show unannotated non-function bindings" = let module Debug_runtime = - (val Minidebug_runtime.debug ~values_first_mode:true - ~log_level:(Prefixed_or_result [||]) ()) + (val Minidebug_runtime.debug ~values_first_mode:true ~log_level:3 ()) in let result = [%track_show @@ -3452,7 +3537,7 @@ let%expect_test "%log_printbox" = {| BEGIN DEBUG SESSION foo = () - ├─"test/test_expect_test.ml":3435:21 + ├─"test/test_expect_test.ml":3520:21 ├─0/0│0/1│0/2│0/3│0/4 │ ───┼───┼───┼───┼─── │ 1/0│1/1│1/2│1/3│1/4 @@ -3517,7 +3602,7 @@ let%expect_test "%log_printbox flushing" = [%expect {| BEGIN DEBUG SESSION - foo begin "test/test_expect_test.ml":3497:21: + foo begin "test/test_expect_test.ml":3582:21: 0/0│0/1│0/2│0/3│0/4 ───┼───┼───┼───┼─── 1/0│1/1│1/2│1/3│1/4 @@ -3542,7 +3627,7 @@ let%expect_test "%log_printbox flushing" = 4/0 4/1 4/2 4/3 4/4 - bar begin "test/test_expect_test.ml":3506:12: + bar begin "test/test_expect_test.ml":3591:12: "Now with a frame:" ┌───┬───┬───┬───┬───┐ │0/0│0/1│0/2│0/3│0/4│ @@ -3602,7 +3687,7 @@ let%expect_test "%log_entry" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":3566:17: _logging_logic + "test/test_expect_test.ml":3651:17: _logging_logic ├─"preamble" ├─header 1 │ ├─"log 1" @@ -3642,36 +3727,36 @@ let%expect_test "flame graph" = print_endline output; [%expect {| -
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
- @@ -3746,31 +3831,31 @@ let%expect_test "flame graph reduced ToC" = print_endline output; [%expect {| -
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
- @@ -3828,10 +3913,10 @@ let%expect_test "%debug_show skip module bindings" = {| BEGIN DEBUG SESSION bar = 15 - ├─"test/test_expect_test.ml":3816:21 + ├─"test/test_expect_test.ml":3901:21 ├─x = 7 └─y = 8 - └─"test/test_expect_test.ml":3818:8 + └─"test/test_expect_test.ml":3903:8 15 |}] @@ -3857,52 +3942,52 @@ let%expect_test "%track_l_show procedure runtime passing" = [%expect {| BEGIN DEBUG SESSION foo-1 - foo-1 foo begin "test/test_expect_test.ml":3843:28: + foo-1 foo begin "test/test_expect_test.ml":3928:28: "inside foo" foo-1 foo end BEGIN DEBUG SESSION foo-1 - foo-1 () begin "test/test_expect_test.ml":3849:8: + foo-1 () begin "test/test_expect_test.ml":3934:8: "inside bar" foo-1 () end BEGIN DEBUG SESSION foo-2 - foo-2 foo begin "test/test_expect_test.ml":3843:28: + foo-2 foo begin "test/test_expect_test.ml":3928:28: "inside foo" foo-2 foo end BEGIN DEBUG SESSION foo-2 - foo-2 () begin "test/test_expect_test.ml":3849:8: + foo-2 () begin "test/test_expect_test.ml":3934:8: "inside bar" foo-2 () end BEGIN DEBUG SESSION foo-3 - foo-3 foo begin "test/test_expect_test.ml":3843:28: + foo-3 foo begin "test/test_expect_test.ml":3928:28: "inside foo" foo-3 foo end BEGIN DEBUG SESSION foo-3 - foo-3 () begin "test/test_expect_test.ml":3849:8: + foo-3 () begin "test/test_expect_test.ml":3934:8: "inside bar" foo-3 () end BEGIN DEBUG SESSION foo-4 - foo-4 foo begin "test/test_expect_test.ml":3843:28: + foo-4 foo begin "test/test_expect_test.ml":3928:28: "inside foo" foo-4 foo end BEGIN DEBUG SESSION foo-4 - foo-4 () begin "test/test_expect_test.ml":3849:8: + foo-4 () begin "test/test_expect_test.ml":3934:8: "inside bar" foo-4 () end BEGIN DEBUG SESSION foo-5 - foo-5 foo begin "test/test_expect_test.ml":3843:28: + foo-5 foo begin "test/test_expect_test.ml":3928:28: "inside foo" foo-5 foo end BEGIN DEBUG SESSION foo-5 - foo-5 () begin "test/test_expect_test.ml":3849:8: + foo-5 () begin "test/test_expect_test.ml":3934:8: "inside bar" foo-5 () end |}] @@ -3922,7 +4007,7 @@ let%expect_test "%track_rt_show expression runtime passing" = [%log_entry "test C"; [%log "line C"]]] - (Minidebug_runtime.debug ~global_prefix:"t3" ~log_level:Nothing ()); + (Minidebug_runtime.debug ~global_prefix:"t3" ~log_level:0 ()); [%expect {| BEGIN DEBUG SESSION t1 @@ -3962,18 +4047,18 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = ┌─────────┐ │bar = 336│ ├─────────┘ - ├─"test/test_expect_test.ml":3946:21 + ├─"test/test_expect_test.ml":4031:21 ├─first = 7 ├─second = 42 └─┬─────┐ │y = 8│ ├─────┘ - └─"test/test_expect_test.ml":3947:8 + └─"test/test_expect_test.ml":4032:8 336 ┌────────┐ │(r1, r2)│ ├────────┘ - ├─"test/test_expect_test.ml":3956:6 + ├─"test/test_expect_test.ml":4041:6 ├─┬─────────┐ │ ││ │ ├─────────┘ @@ -3984,13 +4069,13 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = └─┬────────────────┐ │baz = (339, 109)│ ├────────────────┘ - ├─"test/test_expect_test.ml":3951:10 + ├─"test/test_expect_test.ml":4036:10 ├─first = 7 ├─second = 42 ├─┬──────┐ │ │(y, z)│ │ ├──────┘ - │ ├─"test/test_expect_test.ml":3952:8 + │ ├─"test/test_expect_test.ml":4037:8 │ └─┬────────┐ │ ││ │ ├────────┘ @@ -4001,7 +4086,7 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = └─┬──────┐ │(a, b)│ ├──────┘ - ├─"test/test_expect_test.ml":3953:8 + ├─"test/test_expect_test.ml":4038:8 └─┬────────┐ ││ ├────────┘ diff --git a/test_debug_interrupts.pp.ml b/test_debug_interrupts.pp.ml new file mode 100644 index 0000000..6415ee6 --- /dev/null +++ b/test_debug_interrupts.pp.ml @@ -0,0 +1,292 @@ +[@@@ocaml.ppx.context + { + tool_name = "ppx_driver"; + include_dirs = []; + hidden_include_dirs = []; + load_path = ([], []); + open_modules = []; + for_package = None; + debug = false; + use_threads = false; + use_vmthreads = false; + recursive_types = false; + principal = false; + transparent_modules = false; + unboxed_types = false; + unsafe_string = false; + cookies = [] + }] +module Debug_runtime = (val + Minidebug_runtime.debug_flushing ~filename:"debugger_show_interrupts" ()) +;;Debug_runtime.max_nesting_depth := (Some 5); + Debug_runtime.max_num_children := (Some 10) +;;() +let rec loop_exceeded (x : int) : int= + let __entry_id = Debug_runtime.get_entry_id () in + (); + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"loop_exceeded" ~entry_id:__entry_id + ~is_result:false ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + ((Debug_runtime.open_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:7 ~start_colnum:33 ~end_lnum:9 ~end_colnum:55 + ~message:"loop_exceeded : int" ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x : int") + ~entry_id:__entry_id ~log_level:1 ~is_result:false + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> Ppx_deriving_runtime.Format.fprintf fmt "%d") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) x)); + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"loop_exceeded" + ~entry_id:__entry_id ~is_result:false + ""; + Debug_runtime.close_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:7 ~entry_id:__entry_id; + failwith "ppx_minidebug: max_nesting_depth exceeded") + else + (match let z : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"z" + ~entry_id:__entry_id ~is_result:false + ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log + ~fname:"test/test_debug_interrupts.ml" ~start_lnum:8 + ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 ~message:"z" + ~entry_id:__entry_id ~log_level:1; + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"z" + ~entry_id:__entry_id ~is_result:false + ""; + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" ~start_lnum:8 + ~entry_id:__entry_id; + failwith "ppx_minidebug: max_nesting_depth exceeded") + else + (match (x - 1) / 2 with + | z as __res -> + (((); + Debug_runtime.log_value_show + ?descr:(Some "z : int") ~entry_id:__entry_id + ~log_level:1 ~is_result:true + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning + "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf + "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf + fmt "%d") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) + z)); + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:8 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:8 ~entry_id:__entry_id; + raise e))) in + if x <= 0 then 0 else z + (loop_exceeded (z + (x / 2))) + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "loop_exceeded : int") + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf fmt "%d") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) __res); + Debug_runtime.close_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:7 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:7 ~entry_id:__entry_id; + raise e))) +let () = + try print_endline @@ (Int.to_string @@ (loop_exceeded 17)) + with | _ -> print_endline "Raised exception." +let bar () : unit= + let __entry_id = Debug_runtime.get_entry_id () in + (); + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"bar" ~entry_id:__entry_id + ~is_result:false ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:15 ~start_colnum:19 ~end_lnum:19 ~end_colnum:6 + ~message:"bar : unit" ~entry_id:__entry_id ~log_level:1; + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"bar" ~entry_id:__entry_id + ~is_result:false ""; + Debug_runtime.close_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:15 ~entry_id:__entry_id; + failwith "ppx_minidebug: max_nesting_depth exceeded") + else + (match let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.open_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:16 ~start_colnum:2 ~end_lnum:19 ~end_colnum:6 + ~message:"for:test_debug_interrupts:16" ~entry_id:__entry_id + ~log_level:1; + (match for i = 0 to 100 do + let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.log_value_show ?descr:(Some "i : int") + ~entry_id:__entry_id ~log_level:1 ~is_result:false + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning + "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf fmt + "%d") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) i); + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show ~descr:"i" + ~entry_id:__entry_id ~is_result:false + ""; + failwith "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:16 ~start_colnum:6 ~end_lnum:16 + ~end_colnum:7 ~message:"" + ~entry_id:__entry_id ~log_level:1; + if Debug_runtime.exceeds_max_nesting () + then + (Debug_runtime.log_value_show ~descr:"i" + ~entry_id:__entry_id ~is_result:false + ""; + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 ~entry_id:__entry_id; + failwith + "ppx_minidebug: max_nesting_depth exceeded") + else + (match let _baz : int = + let __entry_id = + Debug_runtime.get_entry_id () in + (); + if Debug_runtime.exceeds_max_children () + then + (Debug_runtime.log_value_show + ~descr:"_baz" ~entry_id:__entry_id + ~is_result:false + ""; + failwith + "ppx_minidebug: max_num_children exceeded") + else + (Debug_runtime.open_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 ~start_colnum:8 + ~end_lnum:17 ~end_colnum:12 + ~message:"_baz" + ~entry_id:__entry_id ~log_level:1; + if + Debug_runtime.exceeds_max_nesting + () + then + (Debug_runtime.log_value_show + ~descr:"_baz" + ~entry_id:__entry_id + ~is_result:false + ""; + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 + ~entry_id:__entry_id; + failwith + "ppx_minidebug: max_nesting_depth exceeded") + else + (match i * 2 with + | _baz as __res -> + (((); + Debug_runtime.log_value_show + ?descr:(Some "_baz : int") + ~entry_id:__entry_id + ~log_level:1 + ~is_result:true + (((let open! ((Ppx_deriving_runtime) + [@ocaml.warning + "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf + "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf + fmt "%d") x) + [@ocaml.warning "-39"] + [@ocaml.warning + "-A"]) _baz)); + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 + ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 + ~entry_id:__entry_id; + raise e))) in + () + with + | () -> + ((); + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 ~entry_id:__entry_id; + ()) + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:17 ~entry_id:__entry_id; + raise e))) + done + with + | () -> + Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" ~start_lnum:16 + ~entry_id:__entry_id + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_interrupts.ml" ~start_lnum:16 + ~entry_id:__entry_id; + raise e)) + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "bar : unit") + ~entry_id:__entry_id ~log_level:1 ~is_result:true + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt () -> + Ppx_deriving_runtime.Format.pp_print_string fmt + "()") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) __res); + Debug_runtime.close_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:15 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_interrupts.ml" + ~start_lnum:15 ~entry_id:__entry_id; + raise e))) +let () = try bar () with | _ -> print_endline "Raised exception." +File "_none_", line 1: +Warning 53 [misplaced-attribute]: the "ocaml.warning" attribute cannot appear in this context diff --git a/test_debug_log_prefixed.pp.ml b/test_debug_log_prefixed.pp.ml new file mode 100644 index 0000000..d87edeb --- /dev/null +++ b/test_debug_log_prefixed.pp.ml @@ -0,0 +1,227 @@ +[@@@ocaml.ppx.context + { + tool_name = "ppx_driver"; + include_dirs = []; + hidden_include_dirs = []; + load_path = ([], []); + open_modules = []; + for_package = None; + debug = false; + use_threads = false; + use_vmthreads = false; + recursive_types = false; + principal = false; + transparent_modules = false; + unboxed_types = false; + unsafe_string = false; + cookies = [] + }] +module Debug_runtime = (val + Minidebug_runtime.debug_flushing ~filename:"debugger_show_log_prefixed" ()) +;;() +let rec loop_exceeded (x : int) : int= + let __entry_id = Debug_runtime.get_entry_id () in + (); + (Debug_runtime.open_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:6 ~start_colnum:33 ~end_lnum:12 ~end_colnum:55 + ~message:"loop_exceeded" ~entry_id:__entry_id ~log_level:1; + Debug_runtime.log_value_show ?descr:(Some "x") ~entry_id:__entry_id + ~is_result:false + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> Ppx_deriving_runtime.Format.fprintf fmt "%d") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) x)); + (match let z : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:7 ~start_colnum:6 ~end_lnum:7 ~end_colnum:7 + ~message:"z" ~entry_id:__entry_id ~log_level:1; + (match Debug_runtime.log_value_show ?descr:None + ~entry_id:__entry_id ~is_result:false + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt (a0, a1) -> + Ppx_deriving_runtime.Format.fprintf fmt "(@["; + ((Ppx_deriving_runtime.Format.fprintf fmt + "%S") a0; + Ppx_deriving_runtime.Format.fprintf fmt + ",@ "; + (Ppx_deriving_runtime.Format.fprintf fmt + "%d") a1); + Ppx_deriving_runtime.Format.fprintf fmt "@])") + x)[@ocaml.warning "-39"][@ocaml.warning "-A"]) + ("inside loop", (x : int))); + (); + (x - 1) / 2 + with + | z as __res -> + (((); + Debug_runtime.log_value_show ?descr:(Some "z") + ~entry_id:__entry_id ~is_result:true + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf fmt "%d") + x)[@ocaml.warning "-39"][@ocaml.warning "-A"]) z)); + Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" ~start_lnum:7 + ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" ~start_lnum:7 + ~entry_id:__entry_id; + raise e)) in + if x <= 0 then 0 else z + (loop_exceeded (z + (x / 2))) + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "loop_exceeded") + ~entry_id:__entry_id ~is_result:true + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> Ppx_deriving_runtime.Format.fprintf fmt "%d") + x)[@ocaml.warning "-39"][@ocaml.warning "-A"]) __res); + Debug_runtime.close_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:6 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:6 ~entry_id:__entry_id; + raise e)) +let () = + try print_endline @@ (Int.to_string @@ (loop_exceeded 7)) + with | _ -> print_endline "Raised exception." +let bar () : unit= + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:18 ~start_colnum:19 ~end_lnum:23 ~end_colnum:6 ~message:"bar" + ~entry_id:__entry_id ~log_level:1; + (match let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.open_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:19 ~start_colnum:2 ~end_lnum:23 ~end_colnum:6 + ~message:"for:test_debug_log_prefixed:19" ~entry_id:__entry_id + ~log_level:1; + (match for i = 0 to 10 do + let __entry_id = Debug_runtime.get_entry_id () in + Debug_runtime.log_value_show ?descr:(Some "i") + ~entry_id:__entry_id ~is_result:false + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf fmt "%d") + x)[@ocaml.warning "-39"][@ocaml.warning "-A"]) i); + Debug_runtime.open_log + ~fname:"test/test_debug_log_prefixed.ml" ~start_lnum:19 + ~start_colnum:6 ~end_lnum:19 ~end_colnum:7 + ~message:"" ~entry_id:__entry_id ~log_level:1; + (match let _baz : int = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log + ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:20 ~start_colnum:8 ~end_lnum:20 + ~end_colnum:12 ~message:"_baz" + ~entry_id:__entry_id ~log_level:1; + (match i * 2 with + | _baz as __res -> + (((); + Debug_runtime.log_value_show + ?descr:(Some "_baz") ~entry_id:__entry_id + ~is_result:true + (((let open! ((Ppx_deriving_runtime) + [@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf + "%a" + (fun fmt -> + Ppx_deriving_runtime.Format.fprintf + fmt "%d") x) + [@ocaml.warning "-39"][@ocaml.warning + "-A"]) _baz)); + Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:20 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:20 ~entry_id:__entry_id; + raise e)) in + Debug_runtime.log_value_show ?descr:None + ~entry_id:__entry_id ~is_result:false + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning + "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt (a0, a1, a2, a3) -> + Ppx_deriving_runtime.Format.fprintf + fmt "(@["; + ((((Ppx_deriving_runtime.Format.fprintf + fmt "%S") a0; + Ppx_deriving_runtime.Format.fprintf + fmt ",@ "; + (Ppx_deriving_runtime.Format.fprintf + fmt "%d") a1); + Ppx_deriving_runtime.Format.fprintf + fmt ",@ "; + (Ppx_deriving_runtime.Format.fprintf + fmt "%S") a2); + Ppx_deriving_runtime.Format.fprintf + fmt ",@ "; + (Ppx_deriving_runtime.Format.fprintf + fmt "%d") a3); + Ppx_deriving_runtime.Format.fprintf + fmt "@])") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) + ("loop step", (i : int), "value", (_baz : int))); + () + with + | () -> + ((); + Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:20 ~entry_id:__entry_id; + ()) + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:20 ~entry_id:__entry_id; + raise e)) + done + with + | () -> + Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" ~start_lnum:19 + ~entry_id:__entry_id + | exception e -> + (Debug_runtime.close_log + ~fname:"test/test_debug_log_prefixed.ml" ~start_lnum:19 + ~entry_id:__entry_id; + raise e)) + with + | __res -> + (Debug_runtime.log_value_show ?descr:(Some "bar") ~entry_id:__entry_id + ~is_result:true + (((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun x -> + Ppx_deriving_runtime.Format.asprintf "%a" + (fun fmt () -> + Ppx_deriving_runtime.Format.pp_print_string fmt "()") x) + [@ocaml.warning "-39"][@ocaml.warning "-A"]) __res); + Debug_runtime.close_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:18 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_log_prefixed.ml" + ~start_lnum:18 ~entry_id:__entry_id; + raise e)) +let () = try bar () with | _ -> print_endline "Raised exception." +File "_none_", line 1: +Warning 53 [misplaced-attribute]: the "ocaml.warning" attribute cannot appear in this context diff --git a/test_debug_pp.pp.ml b/test_debug_pp.pp.ml new file mode 100644 index 0000000..6212e96 --- /dev/null +++ b/test_debug_pp.pp.ml @@ -0,0 +1,216 @@ +[@@@ocaml.ppx.context + { + tool_name = "ppx_driver"; + include_dirs = []; + hidden_include_dirs = []; + load_path = ([], []); + open_modules = []; + for_package = None; + debug = false; + use_threads = false; + use_vmthreads = false; + recursive_types = false; + principal = false; + transparent_modules = false; + unboxed_types = false; + unsafe_string = false; + cookies = [] + }] +module Debug_runtime = (val + Minidebug_runtime.debug_flushing ~filename:"debugger_pp_flushing" ()) +type t = { + first: int ; + second: int }[@@deriving show] +include + struct + let _ = fun (_ : t) -> () + let rec pp : + Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit + = + ((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun fmt x -> + Ppx_deriving_runtime.Format.fprintf fmt "@[<2>{ "; + ((Ppx_deriving_runtime.Format.fprintf fmt "@[%s =@ " + "Test_debug_pp.first"; + (Ppx_deriving_runtime.Format.fprintf fmt "%d") x.first; + Ppx_deriving_runtime.Format.fprintf fmt "@]"); + Ppx_deriving_runtime.Format.fprintf fmt ";@ "; + Ppx_deriving_runtime.Format.fprintf fmt "@[%s =@ " "second"; + (Ppx_deriving_runtime.Format.fprintf fmt "%d") x.second; + Ppx_deriving_runtime.Format.fprintf fmt "@]"); + Ppx_deriving_runtime.Format.fprintf fmt "@ }@]") + [@ocaml.warning "-39"][@ocaml.warning "-A"]) + and show : t -> Ppx_deriving_runtime.string = + fun x -> Ppx_deriving_runtime.Format.asprintf "%a" pp x[@@ocaml.warning + "-32"] + let _ = pp + and _ = show + end[@@ocaml.doc "@inline"][@@merlin.hide ] +type num = int[@@deriving show] +include + struct + let _ = fun (_ : num) -> () + let rec pp_num : + Ppx_deriving_runtime.Format.formatter -> + num -> Ppx_deriving_runtime.unit + = + ((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in + fun fmt -> Ppx_deriving_runtime.Format.fprintf fmt "%d") + [@ocaml.warning "-39"][@ocaml.warning "-A"]) + and show_num : num -> Ppx_deriving_runtime.string = + fun x -> Ppx_deriving_runtime.Format.asprintf "%a" pp_num x[@@ocaml.warning + "-32"] + let _ = pp_num + and _ = show_num + end[@@ocaml.doc "@inline"][@@merlin.hide ] +let bar (x : t) : num= + let __entry_id = Debug_runtime.get_entry_id () in + (); + (Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" ~start_lnum:7 + ~start_colnum:17 ~end_lnum:9 ~end_colnum:14 ~message:"bar" + ~entry_id:__entry_id; + Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp + ~is_result:false x); + (match let y : num = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:8 ~start_colnum:6 ~end_lnum:8 ~end_colnum:7 + ~message:"y" ~entry_id:__entry_id; + (match x.first + 1 with + | y as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "y") + ~entry_id:__entry_id ~pp:pp_num ~is_result:true y); + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:8 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:8 ~entry_id:__entry_id; + raise e)) in + x.second * y + with + | __res -> + (Debug_runtime.log_value_pp ?descr:(Some "bar") ~entry_id:__entry_id + ~pp:pp_num ~is_result:true __res; + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" ~start_lnum:7 + ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" ~start_lnum:7 + ~entry_id:__entry_id; + raise e)) +let () = ignore @@ (bar { first = 7; second = 42 }) +let baz (x : t) : num= + let __entry_id = Debug_runtime.get_entry_id () in + (); + (Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" ~start_lnum:13 + ~start_colnum:17 ~end_lnum:15 ~end_colnum:20 ~message:"baz" + ~entry_id:__entry_id; + Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp + ~is_result:false x); + (match let ({ first = y; second = z } as _yz) : t = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:14 ~start_colnum:36 ~end_lnum:14 ~end_colnum:39 + ~message:"_yz" ~entry_id:__entry_id; + (match { first = (x.first + 1); second = 3 } with + | _yz as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "_yz") + ~entry_id:__entry_id ~pp ~is_result:true _yz); + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:14 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:14 ~entry_id:__entry_id; + raise e)) in + (x.second * y) + z + with + | __res -> + (Debug_runtime.log_value_pp ?descr:(Some "baz") ~entry_id:__entry_id + ~pp:pp_num ~is_result:true __res; + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" ~start_lnum:13 + ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" ~start_lnum:13 + ~entry_id:__entry_id; + raise e)) +let () = ignore @@ (baz { first = 7; second = 42 }) +let rec loop (depth : num) (x : t) : num= + let __entry_id = Debug_runtime.get_entry_id () in + (); + ((Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" ~start_lnum:19 + ~start_colnum:22 ~end_lnum:25 ~end_colnum:9 ~message:"loop" + ~entry_id:__entry_id; + Debug_runtime.log_value_pp ?descr:(Some "depth") ~entry_id:__entry_id + ~pp:pp_num ~is_result:false depth); + Debug_runtime.log_value_pp ?descr:(Some "x") ~entry_id:__entry_id ~pp + ~is_result:false x); + (match if depth > 6 + then x.first + x.second + else + if depth > 3 + then + loop (depth + 1) + { first = (x.second + 1); second = (x.first / 2) } + else + (let y : num = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:23 ~start_colnum:8 ~end_lnum:23 ~end_colnum:9 + ~message:"y" ~entry_id:__entry_id; + (match loop (depth + 1) + { first = (x.second - 1); second = (x.first + 2) } + with + | y as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "y") + ~entry_id:__entry_id ~pp:pp_num ~is_result:true y); + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:23 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:23 ~entry_id:__entry_id; + raise e)) in + let z : num = + let __entry_id = Debug_runtime.get_entry_id () in + (); + Debug_runtime.open_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:24 ~start_colnum:8 ~end_lnum:24 ~end_colnum:9 + ~message:"z" ~entry_id:__entry_id; + (match loop (depth + 1) + { first = (x.second + 1); second = y } + with + | z as __res -> + (((); + Debug_runtime.log_value_pp ?descr:(Some "z") + ~entry_id:__entry_id ~pp:pp_num ~is_result:true z); + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:24 ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" + ~start_lnum:24 ~entry_id:__entry_id; + raise e)) in + z + 7) + with + | __res -> + (Debug_runtime.log_value_pp ?descr:(Some "loop") ~entry_id:__entry_id + ~pp:pp_num ~is_result:true __res; + Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" ~start_lnum:19 + ~entry_id:__entry_id; + __res) + | exception e -> + (Debug_runtime.close_log ~fname:"test/test_debug_pp.ml" ~start_lnum:19 + ~entry_id:__entry_id; + raise e)) +let () = ignore @@ (loop 0 { first = 7; second = 42 }) +File "_none_", line 1: +Warning 53 [misplaced-attribute]: the "ocaml.warning" attribute cannot appear in this context