Skip to content
Snippets Groups Projects
Commit 274827cc authored by David Bühler's avatar David Bühler Committed by Andre Maroneze
Browse files

[kernel] Usable_emitter.get returns [orphan] when the emitter does not exists.

Instead of raising a [Not_found] exception.
Fixes crashes when loading a Frama-C save when an original emitter is not
available.
parent ed1a2930
No related branches found
No related tags found
No related merge requests found
......@@ -365,14 +365,7 @@ let code_annot_emitter ?filter stmt =
try
let tbl = Code_annots.find stmt in
let filter e l acc =
let e =
try Emitter.Usable_emitter.get e
with Not_found ->
(* in some cases, e.g. when loading a state with a different set
of plugins loaded, the original emitter might not be available,
leading to discarding annotations. Let the kernel adopt them. *)
Emitter.orphan
in
let e = Emitter.Usable_emitter.get e in
match filter with
| None -> List.map (fun a -> a, e) l @ acc
| Some f ->
......
......@@ -155,7 +155,7 @@ module Usable_emitter = struct
let mem_project = Datatype.never_any_project
end)
let get e =
let unsafe_get e =
let get_params map =
Datatype.String.Map.fold
(fun s _ acc -> Typed_parameter.get s :: acc)
......@@ -167,6 +167,13 @@ module Usable_emitter = struct
correctness_parameters = get_params e.correctness_values;
tuning_parameters = get_params e.tuning_values }
(* In some cases, e.g. when loading a state with a different set
of plugins loaded, the original emitter might not be available,
leading to discarding annotations. Let the kernel adopt them. *)
let get e =
try unsafe_get e
with Not_found -> orphan
let get_name e = e.u_name
let get_unique_name e = Format.asprintf "%a" pretty e
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment