Skip to content

Instantly share code, notes, and snippets.

@philzook58
Created Nov 5, 2021
Embed
What would you like to do?
Attempting to js_of_ocaml bap
(*
ocamlfind ocamlc -package bap -package core_kernel -linkpkg -linkall baptest.ml
js_of_ocaml +dynlink.js +toplevel.js +zarith_stubs_js/runtime.js +zarith_stubs_js/biginteger.js \
+base/base_internalhash_types/runtime.js +base/runtime.js +time_now/runtime.js +bin_prot/runtime.js \
+ppx_expect/collector/runtime.js +base_bigstring/runtime.js +core_kernel/strftime.js +core_kernel/runtime.js \
+bigstringaf/runtime.js --linkall --extern-fs --toplevel a.out
*)
open Core_kernel
open Bap.Std
let () = match Bap_main.init ~requires:["primus-lisp"] ~log:(`Formatter Format.std_formatter) ~err:(`Formatter Format.std_formatter) () with
| Ok () -> ()
| Error s -> failwith "Something has gone awry"
(*
When I run I get the following error
philip@philip-desktop:~/Documents/ocaml/rawocaml$ node a.js
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/abi.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/analyze.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/api.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/arm.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/beagle.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/bil.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/byteweight.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/cache.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/callgraph_collator.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/callsites.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/comment.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/constant_tracker.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/cxxfilt.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/demangle.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/dependencies.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/disassemble.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/dump_symbols.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/elf_loader.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/flatten.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/frontc_parser.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/glibc_runtime.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/initcore.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/llvm.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/map_terms.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/mc.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/mips.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/myplugin.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/objdump.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/optimization.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/phoenix.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/powerpc.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_dictionary.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_exploring.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_greedy.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_limit.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_lisp.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_loader.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_mark_visited.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_powerpc.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_print.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_promiscuous.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_propagate_taint.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_random.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_region.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_round_robin.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_symbolic_executor.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_systems.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_taint.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_test.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_wandering.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/primus_x86.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/print.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/propagate_taint.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/raw.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/read_symbols.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/recipe_command.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/relocatable.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/report.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/riscv.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/run.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/specification.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/ssa.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/strings.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/stub_resolver.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/systemz.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/taint.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/thumb.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/trace.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/trivial_condition_form.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/vibes.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/warn_unused.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/wp.plugin
loader.debug> Opening bundle /home/philip/.opam/vibes6/lib/bap/x86.plugin
loader.debug> Loading primus-taint from "/home/philip/.opam/vibes6/lib/bap/primus_taint.plugin"
/home/philip/Documents/ocaml/rawocaml/a.js:9210
e=[0,acz,a,b]}throw e}b(d,c);return f}function
^
[
0,
[ 248, Hx { t: 9, c: 'Sys_error', l: 9 }, -2 ],
Hx { t: 9, c: 'Cannot flush a closed channel', l: 29 }
]
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment