Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file trace_main.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107openCore_kernelopenBap_plugins.StdopenBap_future.StdopenBap.StdopenBap_traces.StdopenFormatopenResult.Monad_infixincludeSelf()moduleUnix=Caml_unixletprint_metatrace=Trace.metatrace|>Dict.data|>Seq.to_list|>List.sort~compare:(funm1m2->ifValue.isMeta.trace_statsm1then-1elseifValue.isMeta.trace_statsm2then1elseValue.comparem1m2)|>List.iter~f:(printf"%a@."Value.pp)lettry_dumpuri=Result.map(Trace.loaduri)~f:(funtrace->print_metatrace;printf"@[<v2>events {@\n";Trace.read_eventstrace|>Sequence.iter~f:(printf"%a@\n"Value.pp);printf"@]@\n}")letdumpuri=matchtry_dumpuriwith|Errorerr->Errorerr|Ok()->Ok`Exitletrecload=function|[]->Ok`Done|uri::uris->Trace.loaduri>>=funtrace->Traces.addtrace;loadurisexceptionIncompatibe_argsletmaindump_uriloads=matchdump_uri,loadswith|Some_,_::_->raiseIncompatibe_args|Someuri,[]->dumpuri|None,loads->loadloadsmoduleCmdline=structlet()=Config.manpage[`S"SYNOPSIS";`Pre"
$(b,bap) $(b,--)$(mname)$(b,-dump)=$(i,URI)
$(b,bap) $(i,BINARY) $(b,--)$(mname)$(b,-load)=$(i,URI)...
";`S"DESCRIPTION";`P"Loads and prints traces. The plugin can be used in two
modes. When called as $(b,--)$(mname)$(b,-dump) it will just dump the
specified trace and exit. In the second mode, it will load
specified traces, so that they can be used by
analysis. The loaded traces must be runs of the analyzed
$(i,BINARY). The loaded traces are accessible via the
$(b,Traces) of the traces library.";`S"SEE ALSO";`P"$(b,bap-trace)(3)"]leturi_of_stringstr=leturi=Uri.of_stringstrinmatchUri.schemeuriwith|None->Uri.with_schemeuri(Some"file")|Some_->urileturi=Config.converter(funs->`Ok(uri_of_strings))Uri.pp_humUri.emptyletdump:Uri.toptionConfig.param=letdoc="Dump a trace specified by $(docv)"inConfig.(param(someuri)"dump"~docv:"URI"~doc)letload:Uri.tlistConfig.param=letdoc="Load trace from the specified $(docv). The option maybe
used many times to load several traces"inConfig.(param_alluri"load"~docv:"URI"~doc)letexitffmt=kfprintf(funppf->pp_print_newlineppf();exit1)err_formatterfmtlet()=Config.when_ready(fun{Config.get=(!)}->Future.uponPlugins.loaded(fun()->matchmain!dump!loadwith|Ok`Done->()|Ok`Exit->exit0|Errore->matchewith|`Protocol_errorerr->exitf"Protocol error: %a"Error.pperr|`System_errorerr->exitf"System error: %s"@@Unix.error_messageerr|`No_provider->exitf"No provider for the given URI"|`Ambiguous_uri->exitf"More than one provider for a given URI"|exceptionIncompatibe_args->exitf"Incompatible arguments, see usage SYNOPSIS"))end