forked from radareorg/r2retdec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
r2info.h
64 lines (48 loc) · 1.61 KB
/
r2info.h
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
/**
* @file include/r2plugin/r2info.h
* @brief Information gathering from R2 and user.
* @copyright (c) 2019 Avast Software, licensed under the LGPLv3 license.
*/
#ifndef RETDEC_R2PLUGIN_R2_INFO_H
#define RETDEC_R2PLUGIN_R2_INFO_H
#include <exception>
#include <map>
#include <string>
#include <r_core.h>
#include <r_anal.h>
#include <retdec/config/config.h>
namespace retdec {
namespace r2plugin {
/**
* R2InfoProvider implements wrapper around R2 API functions.
*/
class R2InfoProvider {
public:
R2InfoProvider(RCore &core);
public:
std::string fetchFilePath() const;
common::Function fetchCurrentFunction(ut64 addr) const;
void fetchFunctionsAndGlobals(config::Config &rdconfig) const;
void fetchFunctionLocalsAndArgs(common::Function &function, RAnalFunction &r2fnc) const;
void fetchFunctionCallingconvention(common::Function &function, RAnalFunction &r2fnc) const;
void fetchFunctionReturnType(common::Function &function, RAnalFunction &r2fnc) const;
size_t fetchWordSize() const;
protected:
void fetchGlobals(config::Config &rdconfig) const;
common::Function convertFunctionObject(RAnalFunction &fnc) const;
void fetchExtraArgsData(common::ObjectSequentialContainer &args, RAnalFunction &r2fnc) const;
private:
RCore &_r2core;
static std::map<const std::string, const common::CallingConventionID> _r2rdcc;
};
class DecompilationError: public std::exception {
public:
DecompilationError(const std::string &msg) : _message(msg) {}
~DecompilationError() throw() {}
const char* what() const throw() { return _message.c_str(); }
private:
std::string _message;
};
}
}
#endif /*RETDEC_R2PLUGIN_R2_INFO_H*/