Core.Std.Printexc

Reviewed By: cristianoc

Differential Revision: D4232442

fbshipit-source-id: 556284c
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent e4618541dc
commit 7e6278baeb

@ -305,7 +305,7 @@ let recognize_exception exn =
| Failure _ as f -> | Failure _ as f ->
raise f raise f
| exn -> | exn ->
let exn_name = Printexc.to_string exn in let exn_name = Exn.to_string exn in
(Localise.from_string exn_name, (Localise.from_string exn_name,
Localise.no_desc, None, Exn_developer, Low, None, Nocat) in Localise.no_desc, None, Exn_developer, Low, None, Nocat) in
let visibility' = let visibility' =

@ -52,7 +52,7 @@ let to_json ps =
] ]
let from_json json = let from_json json =
let open Yojson.Basic.Util in let open! Yojson.Basic.Util in
{ {
rtime = json |> member "rtime" |> to_float; rtime = json |> member "rtime" |> to_float;
utime = json |> member "utime" |> to_float; utime = json |> member "utime" |> to_float;
@ -69,8 +69,7 @@ let from_json json =
top_heap_gb = json |> member "top_heap_gb" |> to_float; top_heap_gb = json |> member "top_heap_gb" |> to_float;
stack_kb = json |> member "stack_kb" |> to_float; stack_kb = json |> member "stack_kb" |> to_float;
minor_heap_kb = json |> member "minor_heap_kb" |> to_float; minor_heap_kb = json |> member "minor_heap_kb" |> to_float;
attributes_table = attributes_table = json |> member "attributes_table" |> AttributesTable.from_json;
json |> member "attributes_table" |> AttributesTable.from_json;
} }
let aggregate s = let aggregate s =
@ -152,9 +151,9 @@ let register_report_at_exit file =
close_out stats_oc close_out stats_oc
with exc -> with exc ->
Format.eprintf "Info: failed to write stats to %s@\n%s@\n%s@\n%s@." Format.eprintf "Info: failed to write stats to %s@\n%s@\n%s@\n%s@."
file (Printexc.to_string exc) (Yojson.Basic.pretty_to_string json_stats) file (Exn.to_string exc) (Yojson.Basic.pretty_to_string json_stats)
(Printexc.get_backtrace ()) (Printexc.get_backtrace ())
with exc -> with exc ->
Format.eprintf "Info: failed to compute stats for %s@\n%s@\n%s@." Format.eprintf "Info: failed to compute stats for %s@\n%s@\n%s@."
file (Printexc.to_string exc) (Printexc.get_backtrace ()) file (Exn.to_string exc) (Printexc.get_backtrace ())
) )

@ -168,10 +168,9 @@ let run_proc_analysis ~propagate_exceptions analyze_proc curr_pdesc callee_pdesc
postprocess source; postprocess source;
restore_global_state old_state; restore_global_state old_state;
with exn -> with exn ->
L.stderr "@.ONDEMAND EXCEPTION %a %s@.@.CALL STACK@.%s@.BACK TRACE@.%s@." L.stderr "@.ONDEMAND EXCEPTION %a %s@.@.BACK TRACE@.%s@!"
Procname.pp callee_pname Procname.pp callee_pname
(Printexc.to_string exn) (Exn.to_string exn)
(Printexc.raw_backtrace_to_string (Printexc.get_callstack 1000))
(Printexc.get_backtrace ()); (Printexc.get_backtrace ());
restore_global_state old_state; restore_global_state old_state;
if propagate_exceptions if propagate_exceptions
@ -185,7 +184,7 @@ let run_proc_analysis ~propagate_exceptions analyze_proc curr_pdesc callee_pdesc
log_error_and_continue exn kind log_error_and_continue exn kind
| _ -> | _ ->
(* this happens with assert false or some other unrecognized exception *) (* this happens with assert false or some other unrecognized exception *)
log_error_and_continue exn (FKcrash (Printexc.to_string exn)) log_error_and_continue exn (FKcrash (Exn.to_string exn))
let analyze_proc_desc ~propagate_exceptions curr_pdesc callee_pdesc = let analyze_proc_desc ~propagate_exceptions curr_pdesc callee_pdesc =

@ -204,7 +204,7 @@ let mk ?(deprecated=[]) ?(exes=[])
try closure str try closure str
with exc -> with exc ->
raise (Arg.Bad ("bad value " ^ str ^ " for flag " ^ long raise (Arg.Bad ("bad value " ^ str ^ " for flag " ^ long
^ " (" ^ (Printexc.to_string exc) ^ ")")) in ^ " (" ^ (Exn.to_string exc) ^ ")")) in
let spec = mk_spec setter in let spec = mk_spec setter in
let doc = let doc =
let default_string = default_to_string default in let default_string = default_to_string default in

@ -213,7 +213,7 @@ let pp_ml_loc_opt fmt ml_loc_opt =
let assert_false ((file, lnum, cnum, _) as ml_loc) = let assert_false ((file, lnum, cnum, _) as ml_loc) =
Printf.eprintf "\nASSERT FALSE %s\nCALL STACK\n%s\n%!" Printf.eprintf "\nASSERT FALSE %s\nCALL STACK\n%s\n%!"
(ml_loc_to_string ml_loc) (ml_loc_to_string ml_loc)
(Printexc.raw_backtrace_to_string (Printexc.get_callstack 1000)); (Printexc.get_backtrace ());
raise (Assert_failure (file, lnum, cnum)) raise (Assert_failure (file, lnum, cnum))
(** print a warning with information of the position in the ml source where it oririnated. (** print a warning with information of the position in the ml source where it oririnated.

@ -16,6 +16,7 @@ module Bool = Core.Std.Bool
module Bytes = Core.Std.Bytes module Bytes = Core.Std.Bytes
module Caml = Core.Std.Caml module Caml = Core.Std.Caml
module Char = Core.Std.Char module Char = Core.Std.Char
module Exn = Core.Std.Exn
module Filename = Core.Std.Filename module Filename = Core.Std.Filename
module Fn = Core.Std.Fn module Fn = Core.Std.Fn
module Gc = Core.Std.Gc module Gc = Core.Std.Gc
@ -24,8 +25,11 @@ module Int = Core.Std.Int
module Int32 = Core.Std.Int32 module Int32 = Core.Std.Int32
module Int63 = Core.Std.Int63 module Int63 = Core.Std.Int63
module Int64 = Core.Std.Int64 module Int64 = Core.Std.Int64
module Lazy = Core.Std.Lazy
module Nativeint = Core.Std.Nativeint
module Option = Core.Std.Option module Option = Core.Std.Option
module Pid = Core.Std.Pid module Pid = Core.Std.Pid
module Printexc = Core.Std.Printexc
module Signal = Core.Std.Signal module Signal = Core.Std.Signal
module String = Core.Std.String module String = Core.Std.String
module Sys = struct module Sys = struct

@ -16,6 +16,7 @@ module Bool = Core.Std.Bool
module Bytes = Core.Std.Bytes module Bytes = Core.Std.Bytes
module Caml = Core.Std.Caml module Caml = Core.Std.Caml
module Char = Core.Std.Char module Char = Core.Std.Char
module Exn = Core.Std.Exn
module Filename = Core.Std.Filename module Filename = Core.Std.Filename
module Fn = Core.Std.Fn module Fn = Core.Std.Fn
module Gc = Core.Std.Gc module Gc = Core.Std.Gc
@ -24,8 +25,11 @@ module Int = Core.Std.Int
module Int32 = Core.Std.Int32 module Int32 = Core.Std.Int32
module Int63 = Core.Std.Int63 module Int63 = Core.Std.Int63
module Int64 = Core.Std.Int64 module Int64 = Core.Std.Int64
module Lazy = Core.Std.Lazy
module Nativeint = Core.Std.Nativeint
module Option = Core.Std.Option module Option = Core.Std.Option
module Pid = Core.Std.Pid module Pid = Core.Std.Pid
module Printexc = Core.Std.Printexc
module Signal = Core.Std.Signal module Signal = Core.Std.Signal
module String = Core.Std.String module String = Core.Std.String
module Sys : module type of Core.Std.Sys module Sys : module type of Core.Std.Sys

@ -207,7 +207,7 @@ let check_printf_args_ok tenv
"%s Exception when analyzing %s: %s@." "%s Exception when analyzing %s: %s@."
printf_args_name printf_args_name
(Procname.to_string proc_name) (Procname.to_string proc_name)
(Printexc.to_string e)) (Exn.to_string e))
| None -> ()) | None -> ())
| _ -> () | _ -> ()

Loading…
Cancel
Save