summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2020-10-09 20:57:42 +0000
committerKyleMiles <krm504@nyu.edu>2020-10-19 18:17:44 +0000
commitc7ccd714ceeaabbe5ee682e361250c3cfd54f78f (patch)
treee9f9a6da19ca097f82b4a8f8c00ebba4ea14a590 /binaryninjaapi.h
parent3083903d0ee4ccd18099cb3315e0220c7f5993fb (diff)
Expose Template Simplifier to the API, Adds Tests, and Adds Rust String FFI support to Python (see note)
This introduces the ability to receive and free string from Rust in Python. For it to work, your exposed function name needs to begin with "BNRust", and the generator will create the appropriate code for freeing string return values and arguments.
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 8604e44f..fb5e77fc 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -704,8 +704,12 @@ __attribute__ ((format (printf, 1, 2)))
class BinaryView;
bool DemangleMS(Architecture* arch, const std::string& mangledName, Type** outType,
+ QualifiedName& outVarName, const bool simplify = false);
+ bool DemangleMS(Architecture* arch, const std::string& mangledName, Type** outType,
QualifiedName& outVarName, const Ref<BinaryView>& view);
bool DemangleGNU3(Ref<Architecture> arch, const std::string& mangledName, Type** outType,
+ QualifiedName& outVarName, const bool simplify = false);
+ bool DemangleGNU3(Ref<Architecture> arch, const std::string& mangledName, Type** outType,
QualifiedName& outVarName, const Ref<BinaryView>& view);
void RegisterMainThread(MainThreadActionHandler* handler);
@@ -5401,4 +5405,32 @@ __attribute__ ((format (printf, 1, 2)))
static int Compare(LinearViewCursor* a, LinearViewCursor* b);
};
+
+ class SimplifyName
+ {
+ public:
+ // Use these functions to interface with the simplifier
+ static std::string to_string(const std::string& input);
+ static std::string to_string(const QualifiedName& input);
+ static QualifiedName to_qualified_name(const std::string& input, bool simplify);
+ static QualifiedName to_qualified_name(const QualifiedName& input);
+
+ // Below is everything for the above APIs to work
+ enum SimplifierDest
+ {
+ str,
+ fqn
+ };
+
+ SimplifyName(const std::string&, const SimplifierDest, const bool);
+ ~SimplifyName();
+
+ operator std::string() const;
+ operator QualifiedName();
+
+ private:
+ const char* m_rust_string;
+ const char** m_rust_array;
+ uint64_t m_length;
+ };
}