summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-05-28 18:53:17 -0400
committerGlenn Smith <glenn@vector35.com>2024-06-04 00:29:48 -0400
commit6520026964065327558472841838510176646568 (patch)
tree6a124b7d6aa5efdfafc43fbb2ccaf3af23d35ff2 /binaryninjaapi.h
parent5c7ab961657c6bcfc58c84cf93f850bdb102a425 (diff)
Add AdjustTypeParserArguments callback to platform
Implementing the solution to #4868
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 114b6e85..bb243e52 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -14518,6 +14518,28 @@ namespace BinaryNinja {
static uint32_t* GetGlobalRegistersCallback(void* ctxt, size_t* count);
static void FreeRegisterListCallback(void* ctxt, uint32_t* regs, size_t count);
static BNType* GetGlobalRegisterTypeCallback(void* ctxt, uint32_t reg);
+ static void AdjustTypeParserInputCallback(
+ void* ctxt,
+ BNTypeParser* parser,
+ const char* const* argumentsIn,
+ size_t argumentsLenIn,
+ const char* const* sourceFileNamesIn,
+ const char* const* sourceFileValuesIn,
+ size_t sourceFilesLenIn,
+ char*** argumentsOut,
+ size_t* argumentsLenOut,
+ char*** sourceFileNamesOut,
+ char*** sourceFileValuesOut,
+ size_t* sourceFilesLenOut
+ );
+ static void FreeTypeParserInputCallback(
+ void* ctxt,
+ char** arguments,
+ size_t argumentsLen,
+ char** sourceFileNames,
+ char** sourceFileValues,
+ size_t sourceFilesLen
+ );
public:
Platform(BNPlatform* platform);
@@ -14678,6 +14700,18 @@ namespace BinaryNinja {
*/
virtual Ref<Type> GetGlobalRegisterType(uint32_t reg);
+ /*! Modify the input passed to the Type Parser with Platform-specific features.
+
+ \param[in] parser Type Parser instance
+ \param[in,out] arguments Arguments to the type parser
+ \param[in,out] sourceFiles Source file names and contents
+ */
+ virtual void AdjustTypeParserInput(
+ Ref<class TypeParser> parser,
+ std::vector<std::string>& arguments,
+ std::vector<std::pair<std::string, std::string>>& sourceFiles
+ );
+
Ref<Platform> GetRelatedPlatform(Architecture* arch);
void AddRelatedPlatform(Architecture* arch, Platform* platform);
Ref<Platform> GetAssociatedPlatformByAddress(uint64_t& addr);
@@ -14776,6 +14810,11 @@ namespace BinaryNinja {
virtual std::vector<uint32_t> GetGlobalRegisters() override;
virtual Ref<Type> GetGlobalRegisterType(uint32_t reg) override;
+ virtual void AdjustTypeParserInput(
+ Ref<class TypeParser> parser,
+ std::vector<std::string>& arguments,
+ std::vector<std::pair<std::string, std::string>>& sourceFiles
+ ) override;
};
/*!
@@ -14834,6 +14873,12 @@ namespace BinaryNinja {
*/
static std::string FormatParseErrors(const std::vector<TypeParserError>& errors);
+ /*!
+ Get the Type Parser's registered name
+ \return Parser name
+ */
+ std::string GetName() const;
+
/**
Get the string representation of an option for passing to ParseTypes*
\param option Option type