package binsec

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file disasm_options.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
(**************************************************************************)
(*  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 *)

include Cli.Make (struct
  let name = "disassembly"
  let shortname = "disasm"
end)

type disassembly_mode =
  | Recursive
  | Linear
  | Linear_byte_wise
  | Extended_linear

module Disassembly_mode = struct
  include Builder.Variant_choice_assoc (struct
    type t = disassembly_mode

    let assoc_map =
      [
        ("rec", Recursive);
        ("linear", Linear);
        ("bytelinear", Linear_byte_wise);
        ("extlinear", Extended_linear);
      ]

    let default = Linear
    let name = "mode"
    let doc = " Set disassembly mode"
  end)
end

module DbaOutputFile = Builder.String_option (struct
  let name = "o-dba"
  let doc = Format.sprintf " Set DBA instructions output file"
end)

module OpcodeOutputFile = Builder.String_option (struct
  let name = "dump"
  let doc = " Set opcodes output file [stdout]"
end)

module NoLoaderMode = Builder.False (struct
  let name = "no-loader"
  let doc = "Do not use loader and start at 0x0"
end)

module ShowInstructionCount = Builder.False (struct
  let name = "show-instruction-count"
  let doc = "Show a summary of encountered instructions"
end)

module Sections = Builder.String_set (struct
  let name = "sections"
  let doc = "Disassemble given comma separated list of sections"
end)

module Functions = Builder.String_set (struct
  let name = "functions"
  let doc = "Disassemble given comma separated list of functions"
end)

module Decode_instruction = Builder.String_option (struct
  let name = "decode"
  let doc = "Decode hexadecimal opcode"
end)

module CFG_graph = Builder.False (struct
  let name = "cfgraph"
  let doc = "Print control-flow graph"
end)

module Disasm_at = Builder.String (struct
  let default = "0"
  let name = "at"
  let doc = "Use this address as base for opcode decoding"
end)

module Cache_decoder = Builder.False (struct
  let name = "cache-decoder"

  let doc =
    "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)