IDA Domain
function.hpp
Go to the documentation of this file.
1 #ifndef IDA_DOMAIN_FUNCTION_HPP
2 #define IDA_DOMAIN_FUNCTION_HPP
3 
5 
8 
9 #include <funcs.hpp>
10 #include <string>
11 #include <vector>
12 
13 #ifndef SWIG
15 {
16 #endif
17  class Database;
18 
21  {
23  const Database &m_database;
24 
26  Functions() = delete;
27 
28  public:
31  {
33  const Database &m_database;
34 
36  const ea_t m_start_ea;
37 
39  const ea_t m_end_ea;
40 
42  ea_t m_current_ea = BADADDR;
43 
45  Iterator() = delete;
46 
47  public:
52  Iterator(const Database &database, const ea_t start_ea, const ea_t end_ea)
53  : m_database(database), m_start_ea(start_ea), m_end_ea(end_ea)
54  {
55  }
56 
59  func_t *get_first();
60 
63  func_t *get_next();
64  };
65 
66  public:
69  Functions(const Database &database) : m_database(database)
70  {
71  }
72 
77  Iterator get_between(const ea_t start, const ea_t end) const
78  {
79  return Iterator(m_database, start, end);
80  }
81 
84  Iterator get_all() const
85  {
86  return get_between(inf_get_min_ea(), inf_get_max_ea());
87  }
88 
92  func_t *get_at(const ea_t ea) const;
93 
97  std::string get_name(const func_t *func) const;
98 
103  bool set_name(const func_t *func, const std::string &name) const;
104 
108  BasicBlocks::Iterator get_basic_blocks(const func_t *func) const;
109 
113  Instructions::Iterator get_instructions(const func_t *func) const;
114 
118  std::vector<std::string> get_disassembly(const func_t *func) const;
119 
124  std::vector<std::string> get_pseudocode(const func_t *func, bool remove_tags = true) const;
125 
129  std::string get_signature(const func_t *func) const;
130 
135  bool matches_signature(const func_t *func, const std::string &signature) const;
136 
140  bool create(const ea_t ea) const;
141 
145  bool remove(const ea_t ea) const;
146  };
147 #ifndef SWIG
148 }
149 #endif
150 
151 #endif // IDA_DOMAIN_FUNCTION_HPP
Iterator for basic blocks in a function.
Definition: basic_block.hpp:30
Provides access and control over the loaded IDA database.
Definition: database.hpp:25
Iterator for functions within a specified address range.
Definition: function.hpp:31
func_t * get_first()
Retrieves the first function in the range.
Iterator(const Database &database, const ea_t start_ea, const ea_t end_ea)
Constructs a functions iterator for the given range.
Definition: function.hpp:52
func_t * get_next()
Retrieves the next function after the current one.
Provides access to function-related operations within the database.
Definition: function.hpp:21
BasicBlocks::Iterator get_basic_blocks(const func_t *func) const
Retrieves the basic blocks that compose the given function.
func_t * get_at(const ea_t ea) const
Retrieves the function associated with the given address.
bool create(const ea_t ea) const
Creates a new function at the specified address.
std::string get_signature(const func_t *func) const
Retrieves the function's type signature.
Iterator get_between(const ea_t start, const ea_t end) const
Retrieves functions between specified addresses.
Definition: function.hpp:77
Iterator get_all() const
Retrieves all functions in the database.
Definition: function.hpp:84
std::string get_name(const func_t *func) const
Retrieves the name of the given function.
Functions(const Database &database)
Constructs a functions handler for the given database.
Definition: function.hpp:69
bool set_name(const func_t *func, const std::string &name) const
Renames the given function.
bool remove(const ea_t ea) const
Deletes the function at the specified address.
std::vector< std::string > get_disassembly(const func_t *func) const
Retrieves the disassembly lines for the given function.
bool matches_signature(const func_t *func, const std::string &signature) const
Checks if a function matches the given signature.
std::vector< std::string > get_pseudocode(const func_t *func, bool remove_tags=true) const
Retrieves the decompiled pseudocode of the given function.
Instructions::Iterator get_instructions(const func_t *func) const
Retrieves all instructions within the given function.
Iterator for instructions within a specified address range.
Definition: instruction.hpp:27
#define IDA_API
Definition: common_defines.hpp:11
#define ABI_VERSION_NS
Definition: version.hpp:17