retdec
config.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_CONFIG_CONFIG_H
8 #define RETDEC_LLVMIR2HLL_CONFIG_CONFIG_H
9 
10 #include <cstddef>
11 #include <exception>
12 #include <set>
13 #include <string>
14 
17 
18 namespace retdec {
19 namespace llvmir2hll {
20 
24 class ConfigError: public std::exception {
25 public:
26  ConfigError(const std::string &message);
27 
28  virtual const char *what() const noexcept override;
29 
30  const std::string &getMessage() const noexcept;
31 
32 private:
33  std::string message;
34 };
35 
40 public:
41  virtual ~Config() = default;
42 
45 
49  virtual void saveTo(const std::string &path) = 0;
50 
52 
55 
59  virtual void dump() = 0;
60 
62 
65 
69  virtual bool isGlobalVarStoringWideString(const std::string &var) const = 0;
70 
78  virtual std::string comesFromGlobalVar(const std::string &func,
79  const std::string &var) const = 0;
80 
88  virtual std::string getRegisterForGlobalVar(const std::string &var) const = 0;
89 
96  virtual Address getAddressForGlobalVar(const std::string &var) const = 0;
97 
105  virtual std::string getDetectedCryptoPatternForGlobalVar(const std::string &var) const = 0;
106 
108 
111 
118  virtual std::string getRealNameForFunc(const std::string &func) const = 0;
119 
126  virtual AddressRange getAddressRangeForFunc(const std::string &func) const = 0;
127 
134  virtual LineRange getLineRangeForFunc(const std::string &func) const = 0;
135 
139  virtual bool isDecompilerDefinedFunc(const std::string &func) const = 0;
140 
144  virtual bool isUserDefinedFunc(const std::string &func) const = 0;
145 
149  virtual bool isStaticallyLinkedFunc(const std::string &func) const = 0;
150 
154  virtual bool isDynamicallyLinkedFunc(const std::string &func) const = 0;
155 
159  virtual bool isSyscallFunc(const std::string &func) const = 0;
160 
164  virtual bool isInstructionIdiomFunc(const std::string &func) const = 0;
165 
172  virtual bool isExportedFunc(const std::string &func) const = 0;
173 
179  virtual void markFuncAsStaticallyLinked(const std::string &func) = 0;
180 
187  virtual std::string getDeclarationStringForFunc(const std::string &func) const = 0;
188 
197  virtual std::string getCommentForFunc(const std::string &func) const = 0;
198 
206  virtual StringSet getDetectedCryptoPatternsForFunc(const std::string &func) const = 0;
207 
217  virtual std::string getWrappedFunc(const std::string &func) const = 0;
218 
225  virtual std::string getDemangledNameOfFunc(const std::string &func) const = 0;
226 
228 
231 
235  virtual StringSet getClassNames() const = 0;
236 
244  virtual std::string getClassForFunc(const std::string &func) const = 0;
245 
254  virtual std::string getTypeOfFuncInClass(const std::string &func,
255  const std::string &cl) const = 0;
256 
262  virtual StringVector getBaseClassNames(const std::string &cl) const = 0;
263 
270  virtual std::string getDemangledNameOfClass(const std::string &cl) const = 0;
271 
273 
276 
280  virtual bool isDebugInfoAvailable() const = 0;
281 
288  virtual std::string getDebugModuleNameForFunc(const std::string &func) const = 0;
289 
295  virtual StringSet getDebugModuleNames() const = 0;
296 
303  virtual std::string getDebugNameForGlobalVar(const std::string &var) const = 0;
304 
311  virtual std::string getDebugNameForLocalVar(const std::string &func,
312  const std::string &var) const = 0;
313 
315 
318 
324  virtual std::size_t getNumberOfFuncsDetectedInFrontend() const = 0;
325 
331  virtual std::string getDetectedCompilerOrPacker() const = 0;
332 
338  virtual std::string getDetectedLanguage() const = 0;
339 
345 
347 };
348 
349 } // namespace llvmir2hll
350 } // namespace retdec
351 
352 #endif
Definition: address.h:21
Definition: range.h:45
Base class for all config-related errors.
Definition: config.h:24
const std::string & getMessage() const noexcept
Definition: config.cpp:22
virtual const char * what() const noexcept override
Definition: config.cpp:18
std::string message
Definition: config.h:33
ConfigError(const std::string &message)
Constructs the exception with the given error message.
Definition: config.cpp:15
Base class for all configs.
Definition: config.h:39
virtual void saveTo(const std::string &path)=0
Saves the config to the given file.
virtual StringSet getDebugModuleNames() const =0
Returns a set of module names from which functions originate.
virtual std::string getTypeOfFuncInClass(const std::string &func, const std::string &cl) const =0
Returns the type of the given function in the given class.
virtual std::string getDebugModuleNameForFunc(const std::string &func) const =0
Returns the name of a module from which the given function originates.
virtual LineRange getLineRangeForFunc(const std::string &func) const =0
Returns the line range of the given function.
virtual std::string getDemangledNameOfFunc(const std::string &func) const =0
Returns the demangled named of the given function.
virtual StringVector getBaseClassNames(const std::string &cl) const =0
Returns the names of base classes of the given class.
virtual std::size_t getNumberOfFuncsDetectedInFrontend() const =0
Returns the number of functions detected in the front-end.
virtual std::string getDetectedCompilerOrPacker() const =0
Returns the detected compiler or packer.
virtual std::string comesFromGlobalVar(const std::string &func, const std::string &var) const =0
Returns the name of a global variable from which the given local variable comes from.
virtual bool isSyscallFunc(const std::string &func) const =0
Is the given function, in fact, a system call?
virtual StringSet getSelectedButNotFoundFuncs() const =0
Returns a set of functions that were selected to be decompiled but were not found.
virtual bool isStaticallyLinkedFunc(const std::string &func) const =0
Is the given function statically linked?
virtual std::string getRegisterForGlobalVar(const std::string &var) const =0
Returns the name of the register corresponding to the given global variable.
virtual StringSet getClassNames() const =0
Returns the set of found class names.
virtual std::string getRealNameForFunc(const std::string &func) const =0
Returns the real name of the given function.
virtual void markFuncAsStaticallyLinked(const std::string &func)=0
Marks the given function as statically linked.
virtual ~Config()=default
virtual std::string getDebugNameForLocalVar(const std::string &func, const std::string &var) const =0
Returns a name from debug information of the given local variable from the given function.
virtual std::string getDemangledNameOfClass(const std::string &cl) const =0
Returns the demangled named of the given class.
virtual std::string getCommentForFunc(const std::string &func) const =0
Returns a comment for the given functions.
virtual bool isUserDefinedFunc(const std::string &func) const =0
Is the given function user-defined?
virtual AddressRange getAddressRangeForFunc(const std::string &func) const =0
Returns the address range of the given function.
virtual bool isDynamicallyLinkedFunc(const std::string &func) const =0
Is the given function dynamically linked?
virtual void dump()=0
Dumps the contents of the config to the standard error.
virtual bool isInstructionIdiomFunc(const std::string &func) const =0
Did the given function, in fact, come from an instruction idiom?
virtual bool isGlobalVarStoringWideString(const std::string &var) const =0
Stores the given global variable a wide string?
virtual std::string getDetectedCryptoPatternForGlobalVar(const std::string &var) const =0
Returns a description of the detected cryptographic pattern for the given global variable.
virtual bool isDebugInfoAvailable() const =0
Is Debug info available?
virtual std::string getWrappedFunc(const std::string &func) const =0
Returns the name of a function that func wraps.
virtual StringSet getDetectedCryptoPatternsForFunc(const std::string &func) const =0
Returns a set of names of detected cryptographic patterns that the given function uses.
virtual bool isExportedFunc(const std::string &func) const =0
Is the given function exported?
virtual std::string getDetectedLanguage() const =0
Returns the detected language.
virtual std::string getDebugNameForGlobalVar(const std::string &var) const =0
Returns a name from debug information of the given global variable.
virtual std::string getDeclarationStringForFunc(const std::string &func) const =0
Returns a C declaration string for the given function.
virtual std::string getClassForFunc(const std::string &func) const =0
Returns the name of a class to which the given function belongs.
virtual bool isDecompilerDefinedFunc(const std::string &func) const =0
Is the given function decompiler-defined?
virtual Address getAddressForGlobalVar(const std::string &var) const =0
Returns the address of the given global variable.
A mixin to make classes non-copyable.
Definition: non_copyable.h:27
A library providing API for working with back-end IR.
std::vector< std::string > StringVector
Vector of strings.
Definition: types.h:87
std::set< std::string > StringSet
Set of strings.
Definition: types.h:51
std::pair< std::uint64_t, std::uint64_t > LineRange
Line range.
Definition: types.h:45
Definition: archive_wrapper.h:19
A mixin to make classes non-copyable.
Aliases for several useful types.