12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152(************************************************************************)(* * The Coq Proof Assistant / The Coq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)openTac2expropenProofview.Notationsletbacktrace_evd:backtraceEvd.Store.field=Evd.Store.field()letbacktrace:backtraceExninfo.t=Exninfo.make()letprint_ltac2_backtrace=reffalseletget_backtrace=Proofview.tclEVARMAP>>=funsigma->matchEvd.Store.get(Evd.get_extra_datasigma)backtrace_evdwith|None->Proofview.tclUNIT[]|Somebt->Proofview.tclUNITbtletset_backtracebt=Proofview.tclEVARMAP>>=funsigma->letstore=Evd.get_extra_datasigmainletstore=Evd.Store.setstorebacktrace_evdbtinletsigma=Evd.set_extra_datastoresigmainProofview.Unsafe.tclEVARSsigmaletpr_frame,pr_frame_hook=Hook.make()letwith_frameframetac=lettac=if!print_ltac2_backtracethenget_backtrace>>=funbt->set_backtrace(frame::bt)>>=fun()->Proofview.tclORtac(fun(e,info)->(* If it's already present assume it's more precise *)letinfo=ifOption.has_some(Exninfo.getinfobacktrace)theninfoelseExninfo.addinfobacktrace(frame::bt)inProofview.tclZERO~infoe)>>=funans->set_backtracebt>>=fun()->Proofview.tclUNITanselsetacinletpr_framef=Some(Hook.getpr_framef)inLtac_plugin.Profile_ltac.do_profile_genpr_frameframe~count_call:truetac