IDA Domain
instruction.hpp
Go to the documentation of this file.
1 #ifndef IDA_DOMAIN_INSTRUCTION_HPP
2 #define IDA_DOMAIN_INSTRUCTION_HPP
3 
5 
6 #include <gdl.hpp>
7 #include <string>
8 
9 #ifndef SWIG
11 {
12 #endif
13  class Database;
14 
17  {
19  const Database &m_database;
20 
22  Instructions() = delete;
23 
24  public:
27  {
29  const Database &m_database;
30 
32  const ea_t m_start_ea;
33 
35  const ea_t m_end_ea;
36 
38  ea_t m_current_ea = BADADDR;
39 
41  Iterator() = delete;
42 
43  public:
48  Iterator(const Database &database, const ea_t start_ea, const ea_t end_ea)
49  : m_database(database), m_start_ea(start_ea), m_end_ea(end_ea)
50  {
51  }
52 
55  std::pair<bool, insn_t> get_first();
56 
59  std::pair<bool, insn_t> get_next();
60  };
61 
62  public:
65  Instructions(const Database &database) : m_database(database)
66  {
67  }
68 
72  bool is_valid(const insn_t &insn) const;
73 
77  std::pair<bool, insn_t> decode(ea_t ea) const;
78 
82  std::pair<bool, std::string> get_disassembly(const insn_t &insn) const;
83 
88  Iterator get_between(const ea_t start, const ea_t end) const
89  {
90  return Iterator(m_database, start, end);
91  }
92  };
93 #ifndef SWIG
94 }
95 #endif
96 
97 #endif // IDA_DOMAIN_INSTRUCTION_HPP
Provides access and control over the loaded IDA database.
Definition: database.hpp:25
Iterator for instructions within a specified address range.
Definition: instruction.hpp:27
Iterator(const Database &database, const ea_t start_ea, const ea_t end_ea)
Constructs an instructions iterator for the specified range.
Definition: instruction.hpp:48
std::pair< bool, insn_t > get_next()
Retrieves the next instruction in the range.
std::pair< bool, insn_t > get_first()
Retrieves the first instruction in the range.
Provides access to instruction-related operations.
Definition: instruction.hpp:17
std::pair< bool, insn_t > decode(ea_t ea) const
Decodes the instruction at the specified address.
bool is_valid(const insn_t &insn) const
Checks if the given instruction is valid.
std::pair< bool, std::string > get_disassembly(const insn_t &insn) const
Retrieves the disassembled string representation of the given instruction.
Iterator get_between(const ea_t start, const ea_t end) const
Retrieves instructions between the specified addresses.
Definition: instruction.hpp:88
Instructions(const Database &database)
Constructs an instructions handler for the given database.
Definition: instruction.hpp:65
#define IDA_API
Definition: common_defines.hpp:11
#define ABI_VERSION_NS
Definition: version.hpp:17