diff options
| -rw-r--r-- | binaryninjaapi.h | 4 | ||||
| -rw-r--r-- | binaryninjacore.h | 2 | ||||
| -rw-r--r-- | binaryview.cpp | 4 | ||||
| -rw-r--r-- | python/binaryview.py | 6 | ||||
| -rw-r--r-- | rust/src/binaryview.rs | 4 |
5 files changed, 12 insertions, 8 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 898a1711..bec3474f 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -5080,8 +5080,10 @@ namespace BinaryNinja { /*! Undefine a DataVariable at a given address \param addr virtual address of the DataVariable + \param blacklist whether to add the address to the data variable black list so that the auto analysis would + not recreate the variable on re-analysis */ - void UndefineDataVariable(uint64_t addr); + void UndefineDataVariable(uint64_t addr, bool blacklist = true); /*! Undefine a user DataVariable at a given address diff --git a/binaryninjacore.h b/binaryninjacore.h index 892a9bb5..94625309 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -4863,7 +4863,7 @@ extern "C" BINARYNINJACOREAPI void BNDefineDataVariable(BNBinaryView* view, uint64_t addr, BNTypeWithConfidence* type); BINARYNINJACOREAPI void BNDefineUserDataVariable(BNBinaryView* view, uint64_t addr, BNTypeWithConfidence* type); - BINARYNINJACOREAPI void BNUndefineDataVariable(BNBinaryView* view, uint64_t addr); + BINARYNINJACOREAPI void BNUndefineDataVariable(BNBinaryView* view, uint64_t addr, bool blacklist); BINARYNINJACOREAPI void BNUndefineUserDataVariable(BNBinaryView* view, uint64_t addr); BINARYNINJACOREAPI BNDataVariable* BNGetDataVariables(BNBinaryView* view, size_t* count); BINARYNINJACOREAPI void BNFreeDataVariable(BNDataVariable* var); diff --git a/binaryview.cpp b/binaryview.cpp index 9c1373c1..0570e635 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2058,9 +2058,9 @@ void BinaryView::DefineUserDataVariable(uint64_t addr, const Confidence<Ref<Type } -void BinaryView::UndefineDataVariable(uint64_t addr) +void BinaryView::UndefineDataVariable(uint64_t addr, bool blacklist) { - BNUndefineDataVariable(m_object, addr); + BNUndefineDataVariable(m_object, addr, blacklist); } diff --git a/python/binaryview.py b/python/binaryview.py index 9fa471dd..3321a21a 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -4719,18 +4719,20 @@ class BinaryView: return self.get_data_var_at(addr) - def undefine_data_var(self, addr: int) -> None: + def undefine_data_var(self, addr: int, blacklist: bool = True) -> None: """ ``undefine_data_var`` removes the non-user data variable at the virtual address ``addr``. :param int addr: virtual address to define the data variable to be removed + :param bool blacklist: whether to add the address to the data variable black list so that the auto analysis + would not recreat the variable on re-analysis :rtype: None :Example: >>> bv.undefine_data_var(bv.entry_point) >>> """ - core.BNUndefineDataVariable(self.handle, addr) + core.BNUndefineDataVariable(self.handle, addr, blacklist) def undefine_user_data_var(self, addr: int) -> None: """ diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index ed35bc76..6c8020c6 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -585,9 +585,9 @@ pub trait BinaryViewExt: BinaryViewBase { } } - fn undefine_auto_data_var(&self, addr: u64) { + fn undefine_auto_data_var(&self, addr: u64, blacklist: Option<bool>) { unsafe { - BNUndefineDataVariable(self.as_ref().handle, addr); + BNUndefineDataVariable(self.as_ref().handle, addr, blacklist.unwrap_or(true)); } } |
