123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106(**************************************************************************)(* This file is part of BINSEC. *)(* *)(* Copyright (C) 2016-2026 *)(* 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). *)(* *)(**************************************************************************)(** Generic options for disassembly *)includeCli.Make(structletname="disassembly"letshortname="disasm"end)typedisassembly_mode=|Recursive|Linear|Linear_byte_wise|Extended_linearmoduleDisassembly_mode=structincludeBuilder.Variant_choice_assoc(structtypet=disassembly_modeletassoc_map=[("rec",Recursive);("linear",Linear);("bytelinear",Linear_byte_wise);("extlinear",Extended_linear);]letdefault=Linearletname="mode"letdoc=" Set disassembly mode"end)endmoduleDbaOutputFile=Builder.String_option(structletname="o-dba"letdoc=Format.sprintf" Set DBA instructions output file"end)moduleOpcodeOutputFile=Builder.String_option(structletname="dump"letdoc=" Set opcodes output file [stdout]"end)moduleNoLoaderMode=Builder.False(structletname="no-loader"letdoc="Do not use loader and start at 0x0"end)moduleShowInstructionCount=Builder.False(structletname="show-instruction-count"letdoc="Show a summary of encountered instructions"end)moduleSections=Builder.String_set(structletname="sections"letdoc="Disassemble given comma separated list of sections"end)moduleFunctions=Builder.String_set(structletname="functions"letdoc="Disassemble given comma separated list of functions"end)moduleDecode_instruction=Builder.String_option(structletname="decode"letdoc="Decode hexadecimal opcode"end)moduleCFG_graph=Builder.False(structletname="cfgraph"letdoc="Print control-flow graph"end)moduleDisasm_at=Builder.String(structletdefault="0"letname="at"letdoc="Use this address as base for opcode decoding"end)moduleCache_decoder=Builder.False(structletname="cache-decoder"letdoc="Cache accesses to decoder queries. This option is useful for externally \
provided decoders. Warning: this may be RAM-intensive and assumes code \
under disassembly is not dynamically created"end)