Skip to content

Commit

Permalink
Adapt ocamlobjinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
nojb committed May 17, 2020
1 parent 0294666 commit 1454417
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions tools/objinfo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -244,25 +244,7 @@ let dump_byte ic =
toc

let find_dyn_offset filename =
let helper = Filename.concat Config.standard_library "objinfo_helper" in
let tempfile = Filename.temp_file "objinfo" ".out" in
match
Fun.protect
~finally:(fun () -> remove_file tempfile)
(fun () ->
let rc =
Sys.command
(Filename.quote_command helper ~stdout:tempfile [filename])
in
if rc <> 0 then failwith "cannot read";
let tc = Scanf.Scanning.from_file tempfile in
Fun.protect
~finally:(fun () -> Scanf.Scanning.close_in tc)
(fun () ->
Scanf.bscanf tc "%Ld" (fun x -> x)))
with
| offset -> Some offset
| exception (Failure _ | Sys_error _) -> None
Bfd.find_symbol_offset ~filename "caml_plugin_header"

let exit_err msg = print_endline msg; exit 2
let exit_errf fmt = Printf.ksprintf exit_err fmt
Expand Down

0 comments on commit 1454417

Please sign in to comment.