summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Tong <v35stong@users.noreply.github.com>2019-05-23 18:45:59 -0400
committerStephen Tong <v35stong@users.noreply.github.com>2019-05-28 13:17:54 -0400
commit9c570077a562b4c45e80e6d0cf32f00909e8ebd1 (patch)
tree7e5f3d951ae4d9ae707bb679780df2ac1e1f9dbb
parent46ea950b5d147e14348806ab8ce6b0265efee06f (diff)
Redo/Undo support for user-defined xrefs
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--function.cpp7
-rw-r--r--python/function.py3
4 files changed, 12 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 1d22652d..10c64642 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -2589,6 +2589,7 @@ namespace BinaryNinja
void SetCommentForAddress(uint64_t addr, const std::string& comment);
void SetUserXref(uint64_t addr, uint64_t target);
+ void RemoveUserXref(uint64_t addr, uint64_t target);
Ref<LowLevelILFunction> GetLowLevelIL() const;
size_t GetLowLevelILForInstruction(Architecture* arch, uint64_t addr);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index c1397596..628f53ed 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2529,6 +2529,7 @@ extern "C"
BINARYNINJACOREAPI void BNSetCommentForAddress(BNFunction* func, uint64_t addr, const char* comment);
BINARYNINJACOREAPI void BNSetUserXref(BNFunction* func, uint64_t addr, uint64_t target);
+ BINARYNINJACOREAPI void BNRemoveUserXref(BNFunction* func, uint64_t addr, uint64_t target);
BINARYNINJACOREAPI BNBasicBlock* BNNewBasicBlockReference(BNBasicBlock* block);
BINARYNINJACOREAPI void BNFreeBasicBlock(BNBasicBlock* block);
diff --git a/function.cpp b/function.cpp
index 7ef0926c..54c91541 100644
--- a/function.cpp
+++ b/function.cpp
@@ -245,12 +245,19 @@ void Function::SetCommentForAddress(uint64_t addr, const string& comment)
BNSetCommentForAddress(m_object, addr, comment.c_str());
}
+
void Function::SetUserXref(uint64_t addr, uint64_t target)
{
BNSetUserXref(m_object, addr, target);
}
+void Function::RemoveUserXref(uint64_t addr, uint64_t target)
+{
+ BNRemoveUserXref(m_object, addr, target);
+}
+
+
Ref<LowLevelILFunction> Function::GetLowLevelIL() const
{
return new LowLevelILFunction(BNGetFunctionLowLevelIL(m_object));
diff --git a/python/function.py b/python/function.py
index 1aea500d..36d47791 100644
--- a/python/function.py
+++ b/python/function.py
@@ -1296,6 +1296,9 @@ class Function(object):
def set_user_xref(self, addr, target):
core.BNSetUserXref(self.handle, addr, target)
+ def remove_user_xref(self, addr, target):
+ core.BNRemoveUserXref(self.handle, addr, target)
+
def get_low_level_il_at(self, addr, arch=None):
"""
``get_low_level_il_at`` gets the LowLevelILInstruction corresponding to the given virtual address