123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119(**************************************************************************)(* This file is part of BINSEC. *)(* *)(* Copyright (C) 2016-2022 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* 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, version 2.1. *)(* *)(* It 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. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)openTypesmoduleExpr=structincludeDba.Exprletneg=uminusletsucce=adde(constant(Bitvector.createZ.one(size_ofe)))endmoduleLValue=Dba.LValuemoduleInstr=structtypet=|AssignofLValue.t*Expr.t|UndefofLValue.t|NondetofLValue.t|AssumeofExpr.t|AssertofExpr.t|ItofExpr.t*string|Gotoofstring|JumpofExpr.t|Labelofstring|Haltletassignlocvalue=Assign(loc,value)letundefloc=Undeflocletnondetloc=Nondetlocletassumetest=Assumetestletdynamic_asserttest=Asserttestletconditional_jumptesttarget=It(test,target)letgototarget=Gototargetletdynamic_jumptarget=Jumptargetletlabelname=Labelnamelethalt=Haltletpp_listppfhunk=Format.pp_open_vboxppf0;Format.pp_open_vboxppf2;List.iter(funinstr->matchinstrwith|Assign(lval,rval)->Format.fprintfppf"@ @[<hov>%a := %a@]"Dba_printer.Ascii.pp_lhslvalDba_printer.Ascii.pp_bl_termrval|Undeflval->Format.fprintfppf"@ @[<hov>%a := \\undef@]"Dba_printer.Ascii.pp_lhslval|Nondetlval->Format.fprintfppf"@ @[<hov>%a := \\nondet@]"Dba_printer.Ascii.pp_lhslval|Assumetest->Format.fprintfppf"@ @[<hov>assume %a@]"Dba_printer.Ascii.pp_bl_termtest|Asserttest->Format.fprintfppf"@ @[<hov>assert %a]"Dba_printer.Ascii.pp_bl_termtest|It(test,target)->Format.fprintfppf"@ @[<hov>if %a@ goto %s@]"Dba_printer.Ascii.pp_bl_termtesttarget|Gototarget->Format.fprintfppf"@ goto %s"target|Jumptarget->Format.fprintfppf"@ @[<hov>jump %a@]"Dba_printer.Ascii.pp_bl_termtarget|Labelname->Format.fprintfppf"@]@ @[<v 2>%s:"name|Halt->Format.fprintfppf"@ halt")hunk;Format.pp_close_boxppf();Format.pp_close_boxppf()endmoduleDirective=structtypet=|CutofExpr.toption|AssumeofExpr.t|AssertofExpr.t|Reachofint*Expr.toption*Output.tlist|Enumerateofint*Expr.tendtypet=|Start_fromofExpr.t*Instr.tlist|Start_from_coreofInstr.tlist|Load_sectionsofstringlist|Load_dataofExpr.t|Import_symbolsof(string*Dba.Var.Tag.attribute)list*string|StubofExpr.tlist*Instr.tlist|InitofInstr.tlist|DirectiveofExpr.t*Directive.t