From 93e62cfbf1d5df345020b8b28cc514301dd26064 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 21 Aug 2015 22:04:49 -0400 Subject: Adding type parser --- binaryninjaapi.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index a2779e70..1e5fc879 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -143,6 +143,9 @@ namespace BinaryNinja virtual BNLogLevel GetLogLevel() { return WarningLog; } }; + class Architecture; + class Type; + void Log(BNLogLevel level, const char* fmt, ...); void LogDebug(const char* fmt, ...); void LogInfo(const char* fmt, ...); @@ -161,6 +164,14 @@ namespace BinaryNinja bool PreprocessSource(const std::string& source, const std::string& fileName, std::string& output, std::string& errors, const std::vector& includeDirs = std::vector()); + bool ParseTypesFromSource(Architecture* arch, const std::string& source, const std::string& fileName, + std::map>& types, std::map>& variables, + std::map>& functions, std::string& errors, + const std::vector& includeDirs = std::vector()); + bool ParseTypesFromSourceFile(Architecture* arch, const std::string& fileName, + std::map>& types, std::map>& variables, + std::map>& functions, std::string& errors, + const std::vector& includeDirs = std::vector()); class DataBuffer { @@ -388,7 +399,6 @@ namespace BinaryNinja virtual size_t Write(uint64_t offset, const void* src, size_t len) override; }; - class Architecture; class Function; class BasicBlock; @@ -594,8 +604,6 @@ namespace BinaryNinja BinaryData(FileMetadata* file, FileAccessor* accessor); }; - class Architecture; - class BinaryViewType: public RefCountObject { protected: @@ -940,7 +948,6 @@ namespace BinaryNinja virtual bool SkipAndReturnValue(uint8_t* data, uint64_t addr, size_t len, uint64_t value) override; }; - class Type; class Structure; class Enumeration; @@ -969,6 +976,7 @@ namespace BinaryNinja Ref GetChildType() const; std::vector GetParameters() const; bool HasVariableArguments() const; + bool CanReturn() const; Ref GetStructure() const; Ref GetEnumeration() const; uint64_t GetElementCount() const; @@ -985,7 +993,8 @@ namespace BinaryNinja static Ref EnumerationType(Architecture* arch, Enumeration* enm, size_t width = 0); static Ref PointerType(Architecture* arch, Type* type, bool cnst = false); static Ref ArrayType(Type* type, uint64_t elem); - static Ref FunctionType(Type* returnValue, const std::vector& params, bool varArg = false); + static Ref FunctionType(Type* returnValue, BNCallingConvention callingConvention, + const std::vector& params, bool varArg = false); }; struct StructureMember -- cgit v1.3.1