123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2023 The MOPSA Project. *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License as published *)(* by the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)openCore.AllopenMopsa_utilsopenCallstackopenActionmoduleFileMap=MapExt.StringMapmoduleLineMap=MapExt.IntMapmoduleCallstackMap=MapExt.Make(structtypet=callstackletcompare=compare_callstackend)type'aenvdb=(action*'aCallstackMap.t)LineMap.tFileMap.tletempty_envdb=FileMap.emptyletadd_envdbactionctx(env:'a)man(db:'aenvdb)=letrange=action_rangeactioninletfile=Location.get_range_filerange|>Params.Paths.absolute_pathinletline=Location.get_range_linerangeinletcs=find_ctxcallstack_ctx_keyctxinmatchFileMap.find_optfiledbwith|None->FileMap.addfile(LineMap.singletonline(action,CallstackMap.singletoncsenv))db|Somelmap->matchLineMap.find_optlinelmapwith|None->FileMap.addfile(LineMap.addline(action,CallstackMap.singletoncsenv)lmap)db|Some(action',cmap)->matchCallstackMap.find_optcscmapwith|None->FileMap.addfile(LineMap.addline(action,CallstackMap.addcsenvcmap)lmap)db|Someenv'->letenv''=man.lattice.joinctxenvenv'inFileMap.addfile(LineMap.addline(action,CallstackMap.addcsenv''cmap)lmap)dbletfind_envdbfileline(db:'aenvdb)=FileMap.findfiledb|>LineMap.findlineletfind_envdb_optfilelinedb=trySome(find_envdbfilelinedb)withNot_found->None